pub struct PhantomContravariant<T>(/* private fields */)
where
T: ?Sized;
🔬This is a nightly-only experimental API. (
phantom_variance_markers
#135806)Expand description
Zero-sized type used to mark a type parameter as contravariant.
Types passed as arguments to a function are contravariant. If the type is also part of the return value from a function then it is invariant. See the reference for more information.
§Layout
For all T
, the following are guaranteed:
size_of::<PhantomContravariant<T>>() == 0
align_of::<PhantomContravariant<T>>() == 1
Implementations§
Source§impl<T> PhantomContravariant<T>where
T: ?Sized,
impl<T> PhantomContravariant<T>where
T: ?Sized,
Sourcepub const fn new() -> PhantomContravariant<T>
🔬This is a nightly-only experimental API. (phantom_variance_markers
#135806)
pub const fn new() -> PhantomContravariant<T>
phantom_variance_markers
#135806)Constructs a new instance of the variance marker.
Trait Implementations§
Source§impl<T> Clone for PhantomContravariant<T>where
T: ?Sized,
impl<T> Clone for PhantomContravariant<T>where
T: ?Sized,
Source§fn clone(&self) -> PhantomContravariant<T>
fn clone(&self) -> PhantomContravariant<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for PhantomContravariant<T>where
T: ?Sized,
impl<T> Debug for PhantomContravariant<T>where
T: ?Sized,
Source§impl<T> Default for PhantomContravariant<T>where
T: ?Sized,
impl<T> Default for PhantomContravariant<T>where
T: ?Sized,
Source§fn default() -> PhantomContravariant<T>
fn default() -> PhantomContravariant<T>
Returns the “default value” for a type. Read more
Source§impl<T> Hash for PhantomContravariant<T>where
T: ?Sized,
impl<T> Hash for PhantomContravariant<T>where
T: ?Sized,
Source§impl<T> Ord for PhantomContravariant<T>where
T: ?Sized,
impl<T> Ord for PhantomContravariant<T>where
T: ?Sized,
Source§fn cmp(&self, _: &PhantomContravariant<T>) -> Ordering
fn cmp(&self, _: &PhantomContravariant<T>) -> Ordering
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<T> PartialEq for PhantomContravariant<T>where
T: ?Sized,
impl<T> PartialEq for PhantomContravariant<T>where
T: ?Sized,
Source§impl<T> PartialOrd for PhantomContravariant<T>where
T: ?Sized,
impl<T> PartialOrd for PhantomContravariant<T>where
T: ?Sized,
impl<T> Copy for PhantomContravariant<T>where
T: ?Sized,
impl<T> Eq for PhantomContravariant<T>where
T: ?Sized,
impl<T> Variance for PhantomContravariant<T>where
T: ?Sized,
Auto Trait Implementations§
impl<T> Freeze for PhantomContravariant<T>where
T: ?Sized,
impl<T> RefUnwindSafe for PhantomContravariant<T>where
T: ?Sized,
impl<T> Send for PhantomContravariant<T>where
T: ?Sized,
impl<T> Sync for PhantomContravariant<T>where
T: ?Sized,
impl<T> Unpin for PhantomContravariant<T>where
T: ?Sized,
impl<T> UnwindSafe for PhantomContravariant<T>where
T: ?Sized,
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