Say I have a struct
TheirStruct (maybe in an external crate) that implements the traits
I want to create a struct
MyStruct that uses the implementation for
TheirStruct and has its own implementation for
Bar. Or in other words I want
MyStruct to be like a type alias of
TheirStruct. I just want to override the
Bar trait implementation of
Any way to do this?
There's no builtin automatic way to forward trait implementations. There are crates that might hide some of the boilerplate.
You can implement it yourself.
MyStruct a wrapper around
Foo on it and forward to the
TheirStruct member and implement
Bar they way you want it.
I guess you could also implement
MyStruct and thus benefit from auto-dereferencing in some cases.
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.