Deref for all method but one


I'm wrapping a type in order to add some information to track when one specific method of this type is called.

Is there a way to Deref all the calls but this one method? I know it sounds like overriding a struct's method and that's not possible in Rust, but maybe I'm missing a pattern or some stuff I don't know yet about Rust :slight_smile:

Otherwise I'll need to manually wrap all the methods of the struct…

Deref is used only as a fallback when there's no method implemented directly on the type itself, so simply having impl Wrapper {fn that_method(&self) {}} should be enough.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.