macro_rules! impl_from_uri_param_identity {
    ($(($($l:tt)*) $T:ty),* $(,)?) => { ... };
    ($([$P:ty] ($($l:tt)*) $T:ty),* $(,)?) => { ... };
    ($([$P:ty] $T:ty),* $(,)?) => { ... };
    ($($T:ty),* $(,)?) => { ... };
}
Expand description

Macro to automatically generate identity FromUriParam trait implementations.

For a type T, the identity implementations of FromUriParam are:

  • impl<P: Part> FromUriParam<P, T> for T
  • impl<'x> FromUriParam<P, &'x T> for T
  • impl<'x> FromUriParam<P, &'x mut T> for T

where P is one of:

This macro can be invoked in four ways:

  1. impl_from_uri_param_identity!(Type);

    Generates the three identity implementations for the generic P.

    • Example: impl_from_uri_param_identity!(MyType);
    • Generates: impl<P: Part> FromUriParam<P, _> for MyType { ... }
  2. impl_from_uri_param_identity!((generics*) Type);

    Generates the three identity implementations for the generic P, adding the tokens generics to the impl generics of the generated implementation.

    • Example: impl_from_uri_param_identity!(('a) MyType<'a>);
    • Generates: impl<'a, P: Part> FromUriParam<P, _> for MyType<'a> { ... }
  3. impl_from_uri_param_identity!([Part] Type);

    Generates the three identity implementations for the Part Part, where Part is a path to Path or Query.

    • Example: impl_from_uri_param_identity!([Path] MyType);
    • Generates: impl FromUriParam<Path, _> for MyType { ... }
  4. impl_from_uri_param_identity!([Part] (generics*) Type);

    See 2 and 3.

    • Example: impl_from_uri_param_identity!([Path] ('a) MyType<'a>);
    • Generates: impl<'a> FromUriParam<Path, _> for MyType<'a> { ... }