PhantomContravariant in std::marker - Rust (original) (raw)
Struct PhantomContravariant
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
🔬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