Skip to main content

stringer

Macro stringer 

Source
macro_rules! stringer {
    (impl $ty:ty { $($item:item)+ }) => { ... };
}
Expand description

Generate Stringer + Display + an inherent String() method from one Go-style block.

The user’s fn String(&self) -> string { ... } is captured as a whole item and emitted verbatim inside impl $ty { ... }, which preserves self hygiene. The macro then layers on the Stringer trait impl and the matching Display impl.