Macro supercow::supercow_features [] [src]

macro_rules! supercow_features {
    ($(#[$meta:meta])* pub trait $feature_name:ident: $($stuff:tt)*) => { ... };
    (@_ACCUM $(#[$meta:meta])* pub trait $feature_name:ident:
     $clone:tt $twostep:tt [$($others:tt),*] Clone $($more:tt)*) => { ... };
    (@_ACCUM $(#[$meta:meta])* pub trait $feature_name:ident:
     $clone:tt $twostep:tt [$($others:tt),*]
     TwoStepShared($($inner:tt)*)
     $($more:tt)*) => { ... };
    (@_ACCUM $(#[$meta:meta])* pub trait $feature_name:ident:
     $clone:tt $twostep:tt [$($others:tt),*], $($more:tt)*) => { ... };
    (@_ACCUM $(#[$meta:meta])* pub trait $feature_name:ident:
     $clone:tt $twostep:tt [$($others:ident),*] $other:ident $($more:tt)*) => { ... };
    (@_ACCUM $(#[$meta:meta])* pub trait $feature_name:ident:
     $clone:tt $twostep:tt [$($others:ident),*]) => { ... };
    (@_DEFINE $(#[$meta:meta])*
     pub trait $feature_name:ident:
     [$($clone:ident $clone_boxed:ident)*]
     [$($twostep_inner:ident)*]
     [$($req:ident),*]) => { ... };
}

Defines a "feature set" for a custom Supercow type.

Syntax

#[macro_use] extern crate supercow;


supercow_features!(
  /// Some documentation, etc, if desired.
  pub trait FeatureName: SomeTrait, AnotherTrait);
supercow_features!(
  pub trait FeatureName2: SomeTrait, Clone, AnotherTrait);
Run

Semantics

A public trait named FeatureName is defined which extends all the listed traits, minus special cases below.

If Clone is listed, the trait gains a clone_boxed() method and Box<FeatureName> is Clone.

If TwoStepShared(SomeType) is listed, the boxed type will implement TwoStepShared for all OWNED/BORROWED pairs where SomeType<OWNED,BORROWED> implements the feature a whole and OWNED: SafeBorrow<BORROWED>.

All types which implement all the listed traits (including special cases) implement FeatureName.