Attribute Macro ext_trait::extension

source · []
#[extension]
Expand description

See the main docs for more info.

Advanced features

Extending the trait’s privacy

This can be achieved by prepending a pub annotation before the trait Name argument:

#[macro_use]
extern crate ext_trait;

mod lib {
    //          vvv
    #[extension(pub trait NoOp)]
    impl<T> T {
        fn no_op(self) -> Self { self }
    }
}

fn main ()
{
    use lib::NoOp;
    let x = 42.no_op().no_op().no_op().no_op().no_op().no_op();
}