#[repr(transparent)]pub struct PhantomCovariant<T>(PhantomData<fn() -> T>)
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 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. 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>>() == 0
align_of::<PhantomCovariant<T>>() == 1
Tuple Fields§
§0: PhantomData<fn() -> T>
🔬This is a nightly-only experimental API. (
phantom_variance_markers
#135806)Implementations§
Source§impl<T> PhantomCovariant<T>where
T: ?Sized,
impl<T> PhantomCovariant<T>where
T: ?Sized,
Sourcepub const fn new() -> PhantomCovariant<T>
🔬This is a nightly-only experimental API. (phantom_variance_markers
#135806)
pub const fn new() -> PhantomCovariant<T>
phantom_variance_markers
#135806)Constructs a new instance of the variance marker.
Trait Implementations§
Source§impl<T> Clone for PhantomCovariant<T>where
T: ?Sized,
impl<T> Clone for PhantomCovariant<T>where
T: ?Sized,
Source§fn clone(&self) -> PhantomCovariant<T>
fn clone(&self) -> PhantomCovariant<T>
Returns a duplicate 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 PhantomCovariant<T>where
T: ?Sized,
impl<T> Debug for PhantomCovariant<T>where
T: ?Sized,
Source§impl<T> Default for PhantomCovariant<T>where
T: ?Sized,
impl<T> Default for PhantomCovariant<T>where
T: ?Sized,
Source§fn default() -> PhantomCovariant<T>
fn default() -> PhantomCovariant<T>
Returns the “default value” for a type. Read more
Source§impl<T> Eq for PhantomCovariant<T>where
T: ?Sized,
impl<T> Eq for PhantomCovariant<T>where
T: ?Sized,
#[doc(hidden)] fn assert_receiver_is_total_eq(&self)
Source§impl<T> Hash for PhantomCovariant<T>where
T: ?Sized,
impl<T> Hash for PhantomCovariant<T>where
T: ?Sized,
Source§impl<T> Ord for PhantomCovariant<T>where
T: ?Sized,
impl<T> Ord for PhantomCovariant<T>where
T: ?Sized,
Source§fn cmp(&self, _: &PhantomCovariant<T>) -> Ordering
fn cmp(&self, _: &PhantomCovariant<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 PhantomCovariant<T>where
T: ?Sized,
impl<T> PartialEq for PhantomCovariant<T>where
T: ?Sized,
Source§impl<T> PartialOrd for PhantomCovariant<T>where
T: ?Sized,
impl<T> PartialOrd for PhantomCovariant<T>where
T: ?Sized,
Source§fn partial_cmp(&self, _: &PhantomCovariant<T>) -> Option<Ordering>
fn partial_cmp(&self, _: &PhantomCovariant<T>) -> Option<Ordering>
Source§#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)If
self == other
, returns ControlFlow::Continue(())
.
Otherwise, returns ControlFlow::Break(self < other)
. Read moreSource§#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for <=
instead of <
.Source§#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for >
instead of <
.Source§#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for >=
instead of <
.impl<T> Copy 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
T: ?Sized,
impl<T> RefUnwindSafe for PhantomCovariant<T>where
T: ?Sized,
impl<T> Send for PhantomCovariant<T>where
T: ?Sized,
impl<T> Sync for PhantomCovariant<T>where
T: ?Sized,
impl<T> Unpin for PhantomCovariant<T>where
T: ?Sized,
impl<T> UnwindSafe for PhantomCovariant<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more