Skip to main content

explainable

Attribute Macro explainable 

Source
#[explainable]
Expand description

Annotate an operation trait to generate the full explaining scaffolding for every method in that trait.

§Receiver-type handling

  • self (consuming) — uses std::mem::replace to move the value out safely.
  • &self / &mut self returning Self or Result<Self, E> — calls directly.
  • &mut self returning () or Result<(), E> — calls for side-effect only.

§Associated-type propagation

Method parameters that reference Self::X (associated types from a supertrait) are handled by declaring type X; in the generated FooExt trait and setting type X = T::X; in the blanket impl. No substitution of method signatures is needed.

§#[cfg(…)] propagation

#[cfg(…)] attributes on individual trait methods are forwarded to all generated items.