Macro impl_from_uri_param_identity
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 Timpl<'x> FromUriParam<P, &'x T> for Timpl<'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 tokensgenericsto theimplgenerics 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
PartPart, wherePartis a path toPathorQuery.- 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: