1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
//! Contains many type aliases for PhantomData with different lifetime variances. //! //! These aliases can be constructed in these ways: //! //! - `PhantomData` //! //! - `Variance::<T>::default()` //! //! - `value.ty_()` constructs VariantPhantom //! - `value.ty_d()` constructs VariantDropPhantom //! - `value.ty_inv()` constructs InvariantPhantom //! - `value. ty_inv_ref()` constructs InvariantRefPhantom //! //! //! //! Phantom type lifetime variance type variance //! //! VariantDropPhantom - variant (with drop check) //! VariantPhantom - variant //! InvariantRefPhantom invariant - //! InvariantPhantom - invariant use std_::cell::Cell; use std_::marker::PhantomData; /// Type alias for a variant PhantomData with drop check. pub type VariantDropPhantom<T> = PhantomData<T>; /// Type alias for a variant PhantomData withhout drop-check. pub type VariantPhantom<T> = PhantomData<fn() -> T>; /// Type alias for an invariant PhantomData. pub type InvariantPhantom<T> = PhantomData<fn(T) -> T>; /// Type alias for an PhantomData with an invariant lifetime. pub type InvariantRefPhantom<'a, T> = PhantomData<Cell<&'a T>>;