Quantcast
Channel: Rust - implementing trait for Deref: the parameter type `T` may not live long enough - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by cafce25 for Rust - implementing trait for Deref: the parameter type...

The Box version works because of the deref coercion the compiler will do when it sees a reference and expects a different reference.You can use the same mechanic when using a generic implementor of...

View Article



Rust - implementing trait for Deref: the parameter type `T` may not live long...

I have a trait:trait Foo { fn bar(&self) -> Cow<str>;}And I want to implement it for any type that implements Deref with a target of a type that implements Foo. Basically:impl<T: Foo,...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images