Struct core::kinds::marker::CovariantLifetimeExperimental [-]  [+] [src]

pub struct CovariantLifetime<'a>;

As CovariantType, but for lifetime parameters. Using CovariantLifetime<'a> indicates that it is ok to substitute a longer lifetime for 'a than the one you originally started with (e.g., you could convert any lifetime 'foo to 'static). You almost certainly want ContravariantLifetime instead, or possibly InvariantLifetime. The only case where it would be appropriate is that you have a (type-casted, and hence hidden from the type system) function pointer with a signature like fn(&'a T) (and no other uses of 'a). In this case, it is ok to substitute a larger lifetime for 'a (e.g., fn(&'static T)), because the function is only becoming more selective in terms of what it accepts as argument.

For more information about variance, refer to this Wikipedia article http://en.wikipedia.org/wiki/Variance_%28computer_science%29.

Trait Implementations

Derived Implementations

impl<'a> Ord for CovariantLifetime<'a>

fn cmp(&self, __arg_0: &CovariantLifetime<'a>) -> Ordering

impl<'a> PartialOrd for CovariantLifetime<'a>

fn partial_cmp(&self, __arg_0: &CovariantLifetime<'a>) -> Option<Ordering>

fn lt(&self, __arg_0: &CovariantLifetime<'a>) -> bool

fn le(&self, __arg_0: &CovariantLifetime<'a>) -> bool

fn gt(&self, __arg_0: &CovariantLifetime<'a>) -> bool

fn ge(&self, __arg_0: &CovariantLifetime<'a>) -> bool

impl<'a> Eq for CovariantLifetime<'a>

impl<'a> PartialEq for CovariantLifetime<'a>

fn eq(&self, __arg_0: &CovariantLifetime<'a>) -> bool

fn ne(&self, __arg_0: &CovariantLifetime<'a>) -> bool

impl<'a> Copy for CovariantLifetime<'a>

impl<'a> Clone for CovariantLifetime<'a>

fn clone(&self) -> CovariantLifetime<'a>

fn clone_from(&mut self, source: &Self)