pub struct Lifetime<'a> { /* private fields */ }Expand description
Variance-preserving type wrapper around a lifetime parameter.
This can be useful to indicate the variance of a generic type with respect to a lifetime parameter, rather than a type parameter.
For example:
use type_variance::{Covariant, Lifetime};
struct Guard<'a> {
marker: Covariant<Lifetime<'a>>,
}This marks Guard as being covariant to 'a.
Note that this type is not constructible, and so should be wrapped with
either a PhantomData or one of the variance marker types.
Trait Implementations§
Source§impl<'a> Ord for Lifetime<'a>
impl<'a> Ord for Lifetime<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for Lifetime<'a>
impl<'a> PartialOrd for Lifetime<'a>
impl<'a> Copy for Lifetime<'a>
impl<'a> Eq for Lifetime<'a>
impl<'a> StructuralPartialEq for Lifetime<'a>
Auto Trait Implementations§
impl<'a> Freeze for Lifetime<'a>
impl<'a> RefUnwindSafe for Lifetime<'a>
impl<'a> Send for Lifetime<'a>
impl<'a> Sync for Lifetime<'a>
impl<'a> Unpin for Lifetime<'a>
impl<'a> UnwindSafe for Lifetime<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more