pub unsafe trait Lower<'a> {
type Target: Lower<'a, Target = Self::Target> + ?Sized + 'a;
// Provided method
fn lower_ref<'b>(&'b self) -> &'b Self::Target
where Self: 'a,
'a: 'b { ... }
}Expand description
Indicates that a type covariantly
references a set of lifetime parameters, and when these parameters are all replaced with 'a,
the resulting type is Target. Consequentially, if the type outlives 'a, it can be directly
coerced to Target by applying covariance.
This trait can be trivially implemented for any type by setting Target to be Self. However,
in order to maximize its usefulness, it should operate on as many lifetime parameters as
possible.
This trait can be automatically derived. When deriving on a type with no lifetime parameters,
the trivial implementation will be used (i.e. Target = Self). Otherwise, it will operate
on the first lifetime parameter in the generic parameters list. Deriving will fail if the
type is not covariant in this parameter.
§Safety
The implementor is responsible for ensuring that for all 'a where T: 'a,
<T as Lower<'a>>::Target is a subtype of T.