Hello, i need some help with traits. I'm using glium and glium_text_rusttype (gtr) crates to put text on a window, there is a function in gtr that creates a Textsystem struct which needs a Facade trait.
The problem is that the compiler tells me that the trait "Facade" is not implemented for the struct "Display" even though it is (see the images).
I'm not that good at Rust so i don't know if i'm missing something.
Link to the exemple i'm following for adding the text : glium_text_rusttype/hello_world.rs at master · not-fl3/glium_text_rusttype · GitHub
I already tried to run the "hello world" example in gtr and it works, i don't know why it doesn't work when i do it with my code.
Image of my code (left), the error (bottom) and the implemented trait (right) :
Probably a version mismatch. Looking at the online documentation of the latest version of
bound on the
::new method refers to
glium at version
0.23, whereas the latest
glium version as of now is
0.32, an incompatible version. Thus, the
glium dependency would have been duplicated by
cargo, both versions of
glium coexisting in parallel and considered distinct crates, and the error message talks about
email@example.com not implementing
firstname.lastname@example.org. Go to your
Cargo.toml file and adjust the
glium version accordingly to
0.23 to fix the problem.
glium_text_rusttype (a fork) rather than
glium_text, but I think this could still be the issue -
glium_text_rusttype depends on
glium ">=0.29.1, <0.32.0", but there's now a
glium 0.32.1 that's been released. I think if they have 0.32.1 in their Cargo.toml, they'd end up in the same situation you described.
Ah, I see. I don’t have experience working with crates that have version ranges as dependencies. Anyways, presumably
0.31 in the
Cargo.toml should work then? Otherwise, @Mendred, just look at the output of
cargo tree, and look at the versions of
glium it lists, which would presumably be two versions (one newer one appearing as a direct dependency, and one older one as an indirect dependency through
glium_text_rusttype), and adjust your
Cargo.toml to choose the older one as the direct dependency, too.
cargo tree --duplicates)
Ah, that’s useful! You never stop learning new things
It seems to show an inverted tree starting at all the dependencies that come as duplicates, in multiple versions. Or something along those lines.
Thank you everyone, version 0.31 of glium didn't work for glium_text_rusttype however version 0.26 worked, now the code compile and run.
Ah, it looks like the crates.io version of
glium_text_rusttype has the
0.26 version dependency, whereas the latest master branch on GitHub has the newer dependency that @17cupsofcoffee pointed out above.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.