pub trait WithLifetime<'lt> {
type T;
}
Expand description
HKT
’s internals.
Mainly expected to be used to query the type off an impl HKT
obtained
by Applying a 'lt
, like this:
use ::lending_iterator::higher_kinded_types::{HKT, WithLifetime};
type StringRef = HKT!(<'lt> => &'lt str);
fn example<'s>(s: <StringRef as WithLifetime<'s>>::T) -> &'s str {
s
}
That is, given some Type : HKT
, and some lifetime 'lt
, you can feed
/ apply the lifetime 'lt
to the Type
by using:
It can be used to manually implement HKT
To impl HKT
for some type, you can’t do impl HKT for MyType
.
Instead, you’d have to impl<'lt> WithLifetime<'lt> for MyType
.
- But such use case is not strongly supported by this crate: it is thus
likely that you’ll run into “add
: 'static
” kind of requirements when doing so (because I haven’t attached implicit bounds here, contrary to::polonius_the_crab::HKT
).