Macro zerocopy::macros::unsafe_impl_for_power_set

source ·
macro_rules! unsafe_impl_for_power_set {
    ($first:ident $(, $rest:ident)* $(-> $ret:ident)? => $trait:ident for $macro:ident!(...)) => { ... };
    ($(-> $ret:ident)? => $trait:ident for $macro:ident!(...)) => { ... };
    (@impl $($vars:ident),* $(-> $ret:ident)? => $trait:ident for $macro:ident!(...)) => { ... };
}
Expand description

Implements a trait for a type, bounding on each memeber of the power set of a set of type variables. This is useful for implementing traits for tuples or fn types.

The last argument is the name of a macro which will be called in every impl block, and is expected to expand to the name of the type for which to implement the trait.

For example, the invocation:

unsafe_impl_for_power_set!(A, B => Foo for type!(...))

…expands to:

unsafe impl       Foo for type!()     { ... }
unsafe impl<B>    Foo for type!(B)    { ... }
unsafe impl<A, B> Foo for type!(A, B) { ... }