Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with rust-embed ^6.0 #29

Closed
djrakita opened this issue Mar 19, 2022 · 5 comments
Closed

Incompatibility with rust-embed ^6.0 #29

djrakita opened this issue Mar 19, 2022 · 5 comments
Assignees

Comments

@djrakita
Copy link

Hi,

I am looking to use this library in an ongoing project -- specifically, I am hoping to use the EmbeddedFS features to make an embedded, portable virtual file system for python and WASM ports of my robotics library.

I noticed that using new versions of rust-embed are not compatible with rust-vfs. Specifically, using rust-embed versions ^6.0 causes "the trait rust_embed::RustEmbed is not implemented for ..." errors, even when the struct explicitly derives from RustEmbed. To be clear, this issue is not present for rust-embed versions 5.9 and below; however, it would be great if versions 6.0 and above could be supported since there are really nice features in the newer versions of rust-embed (compression, include-exclude, etc.).

Just let me know if you need any more details, thanks a lot!

@manuel-woelker
Copy link
Owner

Thanks for the note, I'll try to make an update in the next days.

@manuel-woelker
Copy link
Owner

Released in 0.7.0, should be good to go! Let me know if you have any issues.

@agieocean
Copy link

Having what seems like the same issue on 0.10.0, tried downgrading rust-embed to 5.9.0 but still had the same issue

Here's the error I get

error[E0599]: the function or associated item `new` exists for struct `EmbeddedFS<EmbedFFS>`, but its trait bounds were not satisfied
  --> src/lib.rs:26:46
   |
14 | struct EmbedFFS;
   | --------------- doesn't satisfy `EmbedFFS: rust_embed::RustEmbed`
...
26 |   let EFS: VfsPath = EmbeddedFS::<EmbedFFS>::new().into();
   |                                              ^^^ function or associated item cannot be called on `EmbeddedFS<EmbedFFS>` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `EmbedFFS: rust_embed::RustEmbed`
note: the trait `rust_embed::RustEmbed` must be implemented
  --> /home/ag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rust-embed-6.3.0/src/lib.rs:32:1
   |
32 | pub trait RustEmbed {
   | ^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `EmbedFFS: rust_embed::RustEmbed` is not satisfied
  --> src/lib.rs:26:22
   |
26 |   let EFS: VfsPath = EmbeddedFS::<EmbedFFS>::new().into();
   |                      ^^^^^^^^^^^^^^^^^^^^^^ the trait `rust_embed::RustEmbed` is not implemented for `EmbedFFS`
   |
note: required by a bound in `EmbeddedFS`
  --> /home/ag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/vfs-0.10.0/src/impls/embedded.rs:19:8
   |
17 | pub struct EmbeddedFS<T>
   |            ---------- required by a bound in this struct
18 | where
19 |     T: RustEmbed + Send + Sync + Debug + 'static,
   |        ^^^^^^^^^ required by this bound in `EmbeddedFS`

Relevant code:

use rust_embed::RustEmbed;
use vfs:: {
  VfsPath,
  EmbeddedFS,
  VfsError
};

#[derive(RustEmbed)]
#[derive(Debug)]
#[folder = "templates"]
struct EmbedFFS;

let EFS: VfsPath = EmbeddedFS::<EmbedFFS>::new().into();

Cargo.toml

[package]
name = "hello_world"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"
rust-version = "1.57"

[lib]
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "0.2.90"
getrandom = { version = "0.2", features = ["js"] }
tera = {version="1", optional=false}
rust-embed="8.2.0"

[dependencies.web-sys]
version = "0.3.4"
features = [
  'Document',
  'Element',
  'HtmlElement',
  'Node',
  'Window',
]

[dependencies.vfs]
version = "0.10.0"
features = [
'embedded-fs'
]

Note: I'm new to Rust so my apologies if I'm missing something obvious

@manuel-woelker
Copy link
Owner

I think this is a version conflict, the dependency is on "6", which means it is probably incompatible with both a 5.9.0 as well as 8.2.0. Does it work using a 6.x Version of rust-embed in the dependencies?

@agieocean
Copy link

That was it, set it to 6.1.0 and it compiles now, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants