Attribute Macro target

Source
#[target]
Expand description

Define a trait for use of implement macro.

§Arguments (all optional)

  • alternative … Trait. If specified, implement this trait instead of the target trait itself. The target trait is used only for an argument of implement macro. See implementation of traits.

  • newer_type … Set path to newer_type crate. Defaults to ::newer_type. Example: ::your_crate::_export::newer_type.

    §Example

    use newer_type::target;
    
    #[target]
    trait MyTrait {
        fn my_fn(&self) -> ::core::primitive::usize;
    }
    use newer_type::target;
    type TypeFromContext = usize;
    #[target]
    trait MyTrait {
        fn my_fn(&self, t: TypeFromContext) -> Box<usize>;
    }