Macro lending_iterator::higher_kinded_types::Apply
source · [−]pub macro Apply {
(
$HKT:ty, <$lt:lifetime> $(,)?
) => { ... },
(
$($(@$leading:tt)?
:: )? $(
$HKT:ident
)::+
<$lt:lifetime>
$(,)?
) => { ... },
(
$($fallback_to_tt_munching_input:tt)*
) => { ... },
}
Expand description
Given a Type : HKT
, Apply!(Type<'lt>)
“feeds” /
applies <'lt>
to Type
.
use ::lending_iterator::higher_kinded_types::{HKT, Apply};
type StrRef = HKT!(<'lt> => &'lt str);
const EXAMPLE: Apply!(StrRef<'static>) = "This is a `&'static str`";
It’s really just sugar for
Feed<'lt, Type>
.
Usage
-
Apply!(Type<'lifetime>)
(may involve munching whenType
is complex) -
Apply!(Type, <'lifetime>)
(instantly parsed)
Non-macro alternative
If you don’t like using macros in type position, rather than
using Apply!(Type<'lifetime>)
or Apply!(Type, <'lifetime>)
, you can use
Feed<'lifetime, Type>
.