Struct PhantomCovariant
#[repr(transparent)]
pub struct PhantomCovariant<T>(pub(in ::marker::variance) PhantomData<fn() -> T>)
where
T: ?Sized,;
Zero-sized type used to mark a type parameter as covariant.
Types used as part of the return value from a function are covariant. If the type is also passed as a parameter then it is [invariant][PhantomInvariant]. See the reference for more information.
Note: If T is otherwise contravariant or invariant, the resulting type is invariant.
Layout
For all T, the following are guaranteed:
size_of::<PhantomCovariant<T>>() == 0align_of::<PhantomCovariant<T>>() == 1
Fields
0: PhantomData<fn() -> T>
Implementations
impl<T> PhantomCovariant<T>
where
T: ?Sized,
const fn new() -> SelfConstructs a new instance of the variance marker.
Trait Implementations
impl<T> Clone for PhantomCovariant<T>
where
T: ?Sized,
fn clone(&self) -> Self
impl<T> Copy for PhantomCovariant<T>
where
T: ?Sized,
impl<T> Debug for PhantomCovariant<T>
where
T: ?Sized,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Default for PhantomCovariant<T>
where
T: ?Sized,
fn default() -> Self
impl<T> Eq for PhantomCovariant<T>
where
T: ?Sized,
impl<T> Hash for PhantomCovariant<T>
where
T: ?Sized,
fn hash<H: Hasher>(&self, &mut H)
impl<T> Ord for PhantomCovariant<T>
where
T: ?Sized,
fn cmp(&self, &Self) -> Ordering
impl<T> PartialEq for PhantomCovariant<T>
where
T: ?Sized,
fn eq(&self, &Self) -> bool
impl<T> PartialOrd for PhantomCovariant<T>
where
T: ?Sized,
fn partial_cmp(&self, &Self) -> Option<Ordering>
impl<T> PrivateItems for PhantomCovariant<T>
where
T: ?Sized,
const VALUE: Self = _;
impl<T> TrivialClone for PhantomCovariant<T>
where
T: ?Sized,
impl<T> Variance for PhantomCovariant<T>
where
T: ?Sized,
Auto Trait Implementations
impl<T> Freeze for PhantomCovariant<T>
where
PhantomData<fn() -> T>: Freeze,
T: ?Sized,
impl<T> RefUnwindSafe for PhantomCovariant<T>
where
PhantomData<fn() -> T>: RefUnwindSafe,
T: ?Sized,
impl<T> Send for PhantomCovariant<T>
where
PhantomData<fn() -> T>: Send,
T: ?Sized,
impl<T> Sync for PhantomCovariant<T>
where
PhantomData<fn() -> T>: Sync,
T: ?Sized,
impl<T> Unpin for PhantomCovariant<T>
where
PhantomData<fn() -> T>: Unpin,
T: ?Sized,
impl<T> UnsafeUnpin for PhantomCovariant<T>
where
PhantomData<fn() -> T>: UnsafeUnpin,
T: ?Sized,
impl<T> UnwindSafe for PhantomCovariant<T>
where
PhantomData<fn() -> T>: UnwindSafe,
T: ?Sized,
Blanket Implementations
impl<T> Any for PhantomCovariant<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for PhantomCovariant<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for PhantomCovariant<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for PhantomCovariant<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for PhantomCovariant<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Printable for PhantomCovariant<T>
where
T: Copy + Debug,
impl<T> SizeHint for PhantomCovariant<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for PhantomCovariant<T>
impl<T, U> Into<U> for PhantomCovariant<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for PhantomCovariant<T>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for PhantomCovariant<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>