#[repr(transparent)]pub struct PhantomInvariant<T>(PhantomData<fn(T) -> 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 invariant.
Types that are both passed as an argument and used as part of the return value from a function are invariant. See the reference for more information.
§Layout
For all T, the following are guaranteed:
size_of::<PhantomInvariant<T>>() == 0align_of::<PhantomInvariant<T>>() == 1
Tuple Fields§
§0: PhantomData<fn(T) -> T>🔬This is a nightly-only experimental API. (
phantom_variance_markers #135806)Implementations§
Source§impl<T> PhantomInvariant<T>where
T: ?Sized,
impl<T> PhantomInvariant<T>where
T: ?Sized,
Sourcepub const fn new() -> PhantomInvariant<T>
🔬This is a nightly-only experimental API. (phantom_variance_markers #135806)
pub const fn new() -> PhantomInvariant<T>
phantom_variance_markers #135806)Constructs a new instance of the variance marker.
Trait Implementations§
Source§impl<T> Clone for PhantomInvariant<T>where
T: ?Sized,
impl<T> Clone for PhantomInvariant<T>where
T: ?Sized,
Source§fn clone(&self) -> PhantomInvariant<T>
fn clone(&self) -> PhantomInvariant<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T> Copy for PhantomInvariant<T>where
T: ?Sized,
Source§impl<T> Debug for PhantomInvariant<T>where
T: ?Sized,
impl<T> Debug for PhantomInvariant<T>where
T: ?Sized,
Source§impl<T> Default for PhantomInvariant<T>where
T: ?Sized,
impl<T> Default for PhantomInvariant<T>where
T: ?Sized,
Source§fn default() -> PhantomInvariant<T>
fn default() -> PhantomInvariant<T>
Returns the “default value” for a type. Read more
Source§impl<T> Eq for PhantomInvariant<T>where
T: ?Sized,
impl<T> Eq for PhantomInvariant<T>where
T: ?Sized,
1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
👎Deprecated since 1.95.0:
implementation detail of #[derive(Eq)]
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
🔬This is a nightly-only experimental API. (
derive_eq_internals)Source§impl<T> Hash for PhantomInvariant<T>where
T: ?Sized,
impl<T> Hash for PhantomInvariant<T>where
T: ?Sized,
Source§impl<T> Ord for PhantomInvariant<T>where
T: ?Sized,
impl<T> Ord for PhantomInvariant<T>where
T: ?Sized,
Source§fn cmp(&self, _: &PhantomInvariant<T>) -> Ordering
fn cmp(&self, _: &PhantomInvariant<T>) -> Ordering
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T> PartialEq for PhantomInvariant<T>where
T: ?Sized,
impl<T> PartialEq for PhantomInvariant<T>where
T: ?Sized,
Source§impl<T> PartialOrd for PhantomInvariant<T>where
T: ?Sized,
impl<T> PartialOrd for PhantomInvariant<T>where
T: ?Sized,
Source§fn partial_cmp(&self, _: &PhantomInvariant<T>) -> Option<Ordering>
fn partial_cmp(&self, _: &PhantomInvariant<T>) -> Option<Ordering>
Source§#[doc(hidden)]fn __chaining_less(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_less(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)If
self == other, returns Continue(()).
Otherwise, returns Break(self < other), or equivalently Break(self <= other).
The only difference when chaining < and <= is how an equality result is
interpreted at the end of the chain. Read moreSource§#[doc(hidden)]fn __chaining_greater(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)]fn __chaining_greater(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods)Same as
__chaining_less, but for >/>= instead of </<=.impl<T> TrivialClone for PhantomInvariant<T>where
T: ?Sized,
impl<T> Variance for PhantomInvariant<T>where
T: ?Sized,
Auto Trait Implementations§
impl<T> Forget for PhantomInvariant<T>where
T: ?Sized,
impl<T> Freeze for PhantomInvariant<T>
impl<T> Move for PhantomInvariant<T>where
T: ?Sized,
impl<T> RefUnwindSafe for PhantomInvariant<T>where
T: ?Sized,
impl<T> Send for PhantomInvariant<T>where
T: ?Sized,
impl<T> Sync for PhantomInvariant<T>where
T: ?Sized,
impl<T> Unpin for PhantomInvariant<T>where
T: ?Sized,
impl<T> UnsafeUnpin for PhantomInvariant<T>
impl<T> UnwindSafe for PhantomInvariant<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,
impl<T> Printable for T
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
🔬This is a nightly-only experimental API. (
core_io_internals)Returns a lower bound on the number of elements this container-like item
contains.
For example, an array
[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize
#[doc(hidden)]const SIZE: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize
#[doc(hidden)]const ALIGN: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment
#[doc(hidden)]const ALIGNMENT: Alignment
🔬This is a nightly-only experimental API. (
sized_type_properties)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