You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extern crate traitcast;
use traitcast::{TraitcastFrom, Traitcast};
pub trait Widget: TraitcastFrom{
fn print(&self){
println!("Yay from the trait!");
}
}
struct One(u32);
impl One{
fn print_one(&self){
println!("From within one: {}", self.0);
}
}
impl Widget for One{}
struct Two(f32);
impl Two{
fn print_two(&self){
println!("From within two: {}", self.0);
}
}
impl Widget for Two{}
traitcast::traitcast!(struct One: Widget);
traitcast::traitcast!(struct Two: Widget);
However, the compiler notes for the traitcast! lines:
error[E0433]: failed to resolve: use of undeclared type or module `inventory`
--> neith-synth/src/main.rs:100:1
|
100 | traitcast::traitcast!(struct Two: Widget);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type or module `inventory`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Any idea why this might happen?
I also tried version 0.2.1, but it does not work as well.
The text was updated successfully, but these errors were encountered:
This crate doesn't seem to be in active maintenance. If it's ok to switch to another similar crate, I wrote a new crate called intertrait basically motivated by traitcast. Since I have a main project to use it, it will be actively maintained (actually planning to enhance).
Hi,
I tried to used the crate like this:
However, the compiler notes for the traitcast! lines:
Any idea why this might happen?
I also tried version 0.2.1, but it does not work as well.
The text was updated successfully, but these errors were encountered: