Struct core::kinds::marker::ContravariantLifetimeExperimental
[-]
[+]
[src]
pub struct ContravariantLifetime<'a>;
As ContravariantType
, but for lifetime parameters. Using
ContravariantLifetime<'a>
indicates that it is ok to
substitute a shorter lifetime for 'a
than the one you
originally started with (e.g., you could convert 'static
to
any lifetime 'foo
). This is appropriate for cases where you
have an unsafe pointer that is actually a pointer into some
memory with lifetime 'a
, and thus you want to limit the
lifetime of your data structure to 'a
. An example of where
this is used is the iterator for vectors.
For more information about variance, refer to this Wikipedia article http://en.wikipedia.org/wiki/Variance_%28computer_science%29.