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:
-
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 { ... }
- Example:
-
impl_from_uri_param_identity!((generics*) Type);
Generates the three identity implementations for the generic
P
, adding the tokensgenerics
to theimpl
generics of the generated implementation.- Example:
impl_from_uri_param_identity!(('a) MyType<'a>);
- Generates:
impl<'a, P: Part> FromUriParam<P, _> for MyType<'a> { ... }
- Example:
-
impl_from_uri_param_identity!([Part] Type);
Generates the three identity implementations for the
Part
Part
, wherePart
is a path toPath
orQuery
.- Example:
impl_from_uri_param_identity!([Path] MyType);
- Generates:
impl FromUriParam<Path, _> for MyType { ... }
- Example:
-
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> { ... }
- Example: