PhantomInvariant in std::marker - Rust (original) (raw)
Struct PhantomInvariant
pub struct PhantomInvariant<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 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>>() == 0
align_of::<PhantomInvariant<T>>() == 1
🔬This is a nightly-only experimental API. (phantom_variance_markers
#135806)
Constructs a new instance of the variance marker.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self
and other
values if one exists. Read more
Tests less than (for self
and other
) and is used by the <
operator. Read more
Tests less than or equal to (for self
and other
) and is used by the<=
operator. Read more
Tests greater than (for self
and other
) and is used by the >
operator. Read more
Tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more