pub struct VarianceDep {
pub position: VariancePosition,
pub shape: &'static Shape,
}Expand description
A dependency for variance computation.
Represents a type that this type depends on, along with the position (covariant or contravariant) in which it appears.
Fields§
§position: VariancePositionThe position of this dependency (covariant or contravariant)
shape: &'static ShapeThe shape of the dependency
Implementations§
Source§impl VarianceDep
impl VarianceDep
Sourcepub const fn covariant(shape: &'static Shape) -> Self
pub const fn covariant(shape: &'static Shape) -> Self
Create a new variance dependency in covariant position.
Sourcepub const fn contravariant(shape: &'static Shape) -> Self
pub const fn contravariant(shape: &'static Shape) -> Self
Create a new variance dependency in contravariant position.
Sourcepub const fn invariant(shape: &'static Shape) -> Self
pub const fn invariant(shape: &'static Shape) -> Self
Create a new variance dependency in invariant position.
Use this when the outer type is invariant with respect to this parameter, but you still want bivariant inner types to contribute nothing (rather than forcing the whole type to be invariant).
Example: &mut T is invariant with respect to T, but &mut i32 should be
covariant with respect to its own lifetime when computing variance for some
unrelated parameter (since i32 contributes Bivariant).
Trait Implementations§
Source§impl Clone for VarianceDep
impl Clone for VarianceDep
Source§fn clone(&self) -> VarianceDep
fn clone(&self) -> VarianceDep
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more