Type Alias Canonical

Source
pub type Canonical<T> = Canonical<T>;

Aliased Type§

struct Canonical<T> {
    pub value: T,
    pub binders: CanonicalVarKinds<<T as HasInterner>::Interner>,
}

Fields§

§value: T

The item that is canonicalized.

§binders: CanonicalVarKinds<<T as HasInterner>::Interner>

The kind/universe of the variable.

Implementations

§

impl<T> Canonical<T>
where T: HasInterner + Display,

pub fn display( &self, interner: <T as HasInterner>::Interner, ) -> CanonicalDisplay<'_, T>

Display the canonicalized item.

Trait Implementations

§

impl<T, I> CanonicalExt<T, I> for Canonical<T>
where T: HasInterner<Interner = I>, I: Interner,

§

fn map<OP, U>(self, interner: I, op: OP) -> Canonical<U>
where OP: FnOnce(T) -> U, T: TypeFoldable<I>, U: TypeFoldable<I> + HasInterner<Interner = I>,

Maps the contents using op, but preserving the binders.

NB. op will be invoked with an instantiated version of the canonical value, where inference variables (from a fresh inference context) are used in place of the quantified free variables. The result should be in terms of those same inference variables and will be re-canonicalized.

§

impl<T, U> CastTo<Canonical<U>> for Canonical<T>
where T: CastTo<U> + HasInterner, U: HasInterner<Interner = <T as HasInterner>::Interner>,

§

fn cast_to(self, interner: <T as HasInterner>::Interner) -> Canonical<U>

Cast a value to type T.
§

impl<T> Clone for Canonical<T>
where T: Clone + HasInterner, <T as HasInterner>::Interner: Clone,

§

fn clone(&self) -> Canonical<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Canonical<T>
where T: Debug + HasInterner, <T as HasInterner>::Interner: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> HasInterner for Canonical<T>
where T: HasInterner,

§

type Interner = <T as HasInterner>::Interner

The interner associated with the type.
§

impl<T> Hash for Canonical<T>
where T: Hash + HasInterner, <T as HasInterner>::Interner: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<T> PartialEq for Canonical<T>
where T: PartialEq + HasInterner, <T as HasInterner>::Interner: PartialEq,

§

fn eq(&self, other: &Canonical<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<I, T> TypeFoldable<I> for Canonical<T>
where I: Interner, T: HasInterner<Interner = I> + TypeFoldable<I>,

§

fn try_fold_with<E>( self, folder: &mut dyn FallibleTypeFolder<I, Error = E>, outer_binder: DebruijnIndex, ) -> Result<Canonical<T>, E>

Apply the given folder folder to self; binders is the number of binders that are in scope when beginning the folder. Typically binders starts as 0, but is adjusted when we encounter Binders<T> in the IR or other similar constructs.
§

fn fold_with( self, folder: &mut dyn TypeFolder<I, Error = Infallible>, outer_binder: DebruijnIndex, ) -> Self

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
§

impl<I, T> TypeVisitable<I> for Canonical<T>
where I: Interner, T: HasInterner<Interner = I> + TypeVisitable<I>,

§

fn visit_with<B>( &self, visitor: &mut dyn TypeVisitor<I, BreakTy = B>, outer_binder: DebruijnIndex, ) -> ControlFlow<B>

Apply the given visitor visitor to self; binders is the number of binders that are in scope when beginning the visitor. Typically binders starts as 0, but is adjusted when we encounter Binders<T> in the IR or other similar constructs.
§

impl<T> Eq for Canonical<T>
where T: Eq + HasInterner, <T as HasInterner>::Interner: Eq,

§

impl<T> StructuralPartialEq for Canonical<T>
where T: HasInterner,