Struct gluon_check::substitution::Substitution
source · pub struct Substitution<T>where
T: Substitutable,{ /* private fields */ }
Implementations§
source§impl<T> Substitution<T>where
T: Substitutable,
impl<T> Substitution<T>where
T: Substitutable,
pub fn new(factory: T::Factory, interner: T::Interner) -> Substitution<T>
pub fn var_id(&self) -> u32
pub fn insert(&self, var: u32, t: T)
pub fn replace(&mut self, var: u32, t: T)
pub fn reset(&mut self, var: u32)
pub fn snapshot(&mut self) -> Snapshot
pub fn commit(&mut self, snapshot: Snapshot)
pub fn rollback_to(&mut self, snapshot: Snapshot)
sourcepub fn clear_from(&mut self, level: u32)
pub fn clear_from(&mut self, level: u32)
Assumes that no variables unified with anything (but variables < level may exist)
pub fn new_var_fn<F>(&self, f: F) -> T
sourcepub fn real<'r>(&'r self, typ: &'r T) -> &'r T
pub fn real<'r>(&'r self, typ: &'r T) -> &'r T
If typ
is a variable this returns the real unified value of that variable. Otherwise it
just returns the type itself. Note that the returned type may contain terms which also need
to have real
called on them.
pub fn get_var(&self, var: u32) -> Option<&T>
pub fn find_type_for_var(&self, var: u32) -> Option<&T>
pub fn get_level(&self, var: u32) -> u32
pub fn replace_variable(&self, typ: &T) -> Option<T>where
T: Clone,
source§impl<T: Substitutable + Clone> Substitution<T>
impl<T: Substitutable + Clone> Substitution<T>
source§impl<T: Substitutable + PartialEq + Clone> Substitution<T>
impl<T: Substitutable + PartialEq + Clone> Substitution<T>
Trait Implementations§
source§impl<T> Debug for Substitution<T>where
T: Debug + Substitutable,
impl<T> Debug for Substitution<T>where
T: Debug + Substitutable,
source§impl<T> Default for Substitution<T>
impl<T> Default for Substitution<T>
source§fn default() -> Substitution<T>
fn default() -> Substitution<T>
Returns the “default value” for a type. Read more
source§impl<'a> Substitution<Symbol, ArcType> for &'a Substitution<RcType>
impl<'a> Substitution<Symbol, ArcType> for &'a Substitution<RcType>
source§impl<'a, T> TypeContext<Symbol, T> for &'a Substitution<T>where
T: Substitutable + TypePtr<Id = Symbol> + From<Type<Symbol, T>>,
&'a T::Interner: TypeContext<Symbol, T>,
impl<'a, T> TypeContext<Symbol, T> for &'a Substitution<T>where
T: Substitutable + TypePtr<Id = Symbol> + From<Type<Symbol, T>>,
&'a T::Interner: TypeContext<Symbol, T>,
fn intern(&mut self, typ: Type<Symbol, T>) -> T
fn intern_types( &mut self, types: impl IntoIterator<Item = T> ) -> <T as TypePtr>::Types
fn intern_generics( &mut self, types: impl IntoIterator<Item = Generic<Symbol>> ) -> <T as TypePtr>::Generics
fn intern_fields( &mut self, types: impl IntoIterator<Item = Field<<T as TypePtr>::SpannedId, T>> ) -> <T as TypePtr>::Fields
fn intern_type_fields( &mut self, types: impl IntoIterator<Item = Field<<T as TypePtr>::SpannedId, Alias<Symbol, T>>> ) -> <T as TypePtr>::TypeFields
fn intern_flags(&mut self, typ: Type<Symbol, T>, flags: Flags) -> T
fn builtin(&mut self, typ: BuiltinType) -> T
fn forall(&mut self, params: <T as TypePtr>::Generics, typ: T) -> T
fn with_forall(&mut self, typ: T, from: &T) -> T
fn array(&mut self, typ: T) -> T
fn app(&mut self, id: T, args: <T as TypePtr>::Types) -> T
fn variant(&mut self, fields: <T as TypePtr>::Fields) -> T
fn poly_variant(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn effect(&mut self, fields: <T as TypePtr>::Fields) -> T
fn poly_effect(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn record( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields ) -> T
fn poly_record( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields, rest: T ) -> T
fn extend_full_row( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields, rest: T ) -> T
fn extend_row(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn extend_type_row(&mut self, types: <T as TypePtr>::TypeFields, rest: T) -> T
fn generic(&mut self, typ: Generic<Symbol>) -> T
fn skolem(&mut self, typ: Skolem<Symbol>) -> T
fn variable(&mut self, typ: TypeVariable) -> T
fn alias(&mut self, name: Symbol, args: <T as TypePtr>::Generics, typ: T) -> T
fn ident(&mut self, id: KindedIdent<Symbol>) -> T
fn projection(&mut self, id: AppVec<Symbol>) -> T
fn builtin_type(&mut self, typ: BuiltinType) -> T
fn new_alias( &mut self, name: Symbol, args: <T as TypePtr>::Generics, typ: T ) -> Alias<Symbol, T>
fn new_data_alias(&mut self, data: AliasData<Symbol, T>) -> Alias<Symbol, T>
fn alias_group( &mut self, group: Vec<AliasData<Symbol, T>> ) -> Vec<Alias<Symbol, T>>
fn hole(&mut self) -> T
fn opaque(&mut self) -> T
fn error(&mut self) -> T
fn array_builtin(&mut self) -> T
fn empty_row(&mut self) -> T
fn function_builtin(&mut self) -> T
fn string(&mut self) -> T
fn char(&mut self) -> T
fn byte(&mut self) -> T
fn int(&mut self) -> T
fn float(&mut self) -> T
fn unit(&mut self) -> T
fn function<I>(&mut self, args: I, ret: T) -> T
fn function_implicit<I>(&mut self, args: I, ret: T) -> T
fn function_type<I>(&mut self, arg_type: ArgType, args: I, ret: T) -> T
source§impl<T> TypeContext<Symbol, T> for Substitution<T>where
T: Substitutable + TypePtr<Id = Symbol> + From<Type<Symbol, T>>,
for<'a> &'a T::Interner: TypeContext<Symbol, T>,
impl<T> TypeContext<Symbol, T> for Substitution<T>where
T: Substitutable + TypePtr<Id = Symbol> + From<Type<Symbol, T>>,
for<'a> &'a T::Interner: TypeContext<Symbol, T>,
fn intern(&mut self, typ: Type<Symbol, T>) -> T
fn intern_types( &mut self, types: impl IntoIterator<Item = T> ) -> <T as TypePtr>::Types
fn intern_generics( &mut self, types: impl IntoIterator<Item = Generic<Symbol>> ) -> <T as TypePtr>::Generics
fn intern_fields( &mut self, types: impl IntoIterator<Item = Field<<T as TypePtr>::SpannedId, T>> ) -> <T as TypePtr>::Fields
fn intern_type_fields( &mut self, types: impl IntoIterator<Item = Field<<T as TypePtr>::SpannedId, Alias<Symbol, T>>> ) -> <T as TypePtr>::TypeFields
fn intern_flags(&mut self, typ: Type<Symbol, T>, flags: Flags) -> T
fn builtin(&mut self, typ: BuiltinType) -> T
fn forall(&mut self, params: <T as TypePtr>::Generics, typ: T) -> T
fn with_forall(&mut self, typ: T, from: &T) -> T
fn array(&mut self, typ: T) -> T
fn app(&mut self, id: T, args: <T as TypePtr>::Types) -> T
fn variant(&mut self, fields: <T as TypePtr>::Fields) -> T
fn poly_variant(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn effect(&mut self, fields: <T as TypePtr>::Fields) -> T
fn poly_effect(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn record( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields ) -> T
fn poly_record( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields, rest: T ) -> T
fn extend_full_row( &mut self, types: <T as TypePtr>::TypeFields, fields: <T as TypePtr>::Fields, rest: T ) -> T
fn extend_row(&mut self, fields: <T as TypePtr>::Fields, rest: T) -> T
fn extend_type_row(&mut self, types: <T as TypePtr>::TypeFields, rest: T) -> T
fn generic(&mut self, typ: Generic<Symbol>) -> T
fn skolem(&mut self, typ: Skolem<Symbol>) -> T
fn variable(&mut self, typ: TypeVariable) -> T
fn alias(&mut self, name: Symbol, args: <T as TypePtr>::Generics, typ: T) -> T
fn ident(&mut self, id: KindedIdent<Symbol>) -> T
fn projection(&mut self, id: AppVec<Symbol>) -> T
fn builtin_type(&mut self, typ: BuiltinType) -> T
fn new_alias( &mut self, name: Symbol, args: <T as TypePtr>::Generics, typ: T ) -> Alias<Symbol, T>
fn new_data_alias(&mut self, data: AliasData<Symbol, T>) -> Alias<Symbol, T>
fn alias_group( &mut self, group: Vec<AliasData<Symbol, T>> ) -> Vec<Alias<Symbol, T>>
fn hole(&mut self) -> T
fn opaque(&mut self) -> T
fn error(&mut self) -> T
fn array_builtin(&mut self) -> T
fn empty_row(&mut self) -> T
fn function_builtin(&mut self) -> T
fn string(&mut self) -> T
fn char(&mut self) -> T
fn byte(&mut self) -> T
fn int(&mut self) -> T
fn float(&mut self) -> T
fn unit(&mut self) -> T
fn function<I>(&mut self, args: I, ret: T) -> T
fn function_implicit<I>(&mut self, args: I, ret: T) -> T
fn function_type<I>(&mut self, arg_type: ArgType, args: I, ret: T) -> T
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Substitution<T>
impl<T> Send for Substitution<T>
impl<T> !Sync for Substitution<T>
impl<T> Unpin for Substitution<T>
impl<T> UnwindSafe for Substitution<T>where
T: UnwindSafe,
<T as Substitutable>::Factory: UnwindSafe,
<T as Substitutable>::Interner: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more