Enum GenericParamVariance
pub enum GenericParamVariance {
Invariant,
Covariant,
Contravariant,
}Expand description
Variance classification of a generic parameter (ECMA-335 §II.22.20).
Returned by GenericParamAttributes::variance. The three variants are
fixed by the standard and mutually exclusive — exactly one applies to any
given generic parameter.
§Stability
The string returned by GenericParamVariance::as_str and by the
Display impl is part of the stable public API. It is safe to persist
(file, database, log line) and to parse.
Variants§
Invariant
No variance — exact type match required.
Corresponds to ECMA-335 variance bits 0x00 (and the reserved/undefined
pattern 0x03).
Covariant
Covariant — type argument may be a more derived type.
Corresponds to ECMA-335 variance bit 0x01 and the C# out keyword
(e.g. IEnumerable<out T>).
Contravariant
Contravariant — type argument may be a less derived type.
Corresponds to ECMA-335 variance bit 0x02 and the C# in keyword
(e.g. Action<in T>).
Implementations§
Trait Implementations§
§impl Clone for GenericParamVariance
impl Clone for GenericParamVariance
§fn clone(&self) -> GenericParamVariance
fn clone(&self) -> GenericParamVariance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for GenericParamVariance
§impl Debug for GenericParamVariance
impl Debug for GenericParamVariance
§impl Display for GenericParamVariance
impl Display for GenericParamVariance
impl Eq for GenericParamVariance
§impl Hash for GenericParamVariance
impl Hash for GenericParamVariance
§impl PartialEq for GenericParamVariance
impl PartialEq for GenericParamVariance
impl StructuralPartialEq for GenericParamVariance
Auto Trait Implementations§
impl Freeze for GenericParamVariance
impl RefUnwindSafe for GenericParamVariance
impl Send for GenericParamVariance
impl Sync for GenericParamVariance
impl Unpin for GenericParamVariance
impl UnsafeUnpin for GenericParamVariance
impl UnwindSafe for GenericParamVariance
Blanket Implementations§
impl<T> Boilerplate for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more