Trait gluon_base::types::TypeExt
source · pub trait TypeExt: TypePtr<Types = AppVec<Self>, Generics = Vec<Generic<<Self as TypePtr>::Id>>, Fields = Vec<Field<<Self as TypePtr>::SpannedId, Self>>, TypeFields = Vec<Field<<Self as TypePtr>::SpannedId, Alias<<Self as TypePtr>::Id, Self>>>> + Clone + Sized {
Show 17 methods
// Required method
fn strong_count(typ: &Self) -> usize;
// Provided methods
fn type_field_iter(&self) -> TypeFieldIterator<'_, Self> ⓘ { ... }
fn arg_iter(&self) -> ArgIterator<'_, Self> ⓘ { ... }
fn implicit_arg_iter(&self) -> ImplicitArgIterator<'_, Self> ⓘ { ... }
fn row_iter(&self) -> RowIterator<'_, Self> ⓘ { ... }
fn remove_implicit_args<'a>(&'a self) -> &'a Self { ... }
fn remove_forall<'a>(&'a self) -> &'a Self { ... }
fn remove_forall_and_implicit_args<'a>(&'a self) -> &'a Self { ... }
fn replace_generics(
&self,
interner: &mut impl TypeContext<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Option<Self>
where Self::Id: Clone + Eq + Hash,
Self::SpannedId: Clone,
Self: Clone,
Self::Types: Clone,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn replace_generics_(
&self,
interner: &mut impl TypeContext<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Option<Self>
where Self::Id: Clone + Eq + Hash,
Self::SpannedId: Clone,
Self: Clone,
Self::Types: Clone,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn forall_scope_iter(&self) -> ForallScopeIter<'_, Self> ⓘ { ... }
fn pretty<'a, A>(
&'a self,
arena: &'a Arena<'a, A>
) -> DocBuilder<'a, Arena<'a, A>, A>
where Self::Id: AsRef<str> + 'a,
Self::SpannedId: AsRef<str> + AsId<Self::Id> + 'a,
A: Clone,
Self: HasMetadata + HasSpan { ... }
fn apply_args<'a>(
&self,
params: &[Generic<Self::Id>],
args: &'a [Self],
interner: &mut impl TypeContext<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Option<Self>
where Self::Id: Clone + Eq + Hash + Display,
Self::SpannedId: Clone,
Self: Display,
Self::Types: Clone + FromIterator<Self>,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn arg_application<'a>(
&self,
params: &[Generic<Self::Id>],
args: &'a [Self],
interner: &mut impl TypeContext<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Option<(Self, &'a [Self])>
where Self::Id: Clone + Eq + Hash + Display,
Self: Display,
Self::Types: FromIterator<Self>,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn instantiate_generics(
&self,
interner: &mut impl Substitution<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Self
where Self::Id: Clone + Eq + Hash,
Self::SpannedId: Clone,
Self::Types: Clone,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn skolemize(
&self,
interner: &mut impl Substitution<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Self
where Self::Id: Clone + Eq + Hash,
Self::SpannedId: Clone,
Self::Types: Clone,
Self::Generics: Clone,
Self::Fields: Clone { ... }
fn skolemize_in(
&self,
interner: &mut impl Substitution<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>,
f: impl FnOnce(Self) -> Self
) -> Self
where Self::Id: Clone + Eq + Hash,
Self::SpannedId: Clone,
Self::Types: Clone,
Self::Generics: FromIterator<Generic<Self::Id>> + Clone,
Self::Fields: Clone { ... }
}
Required Methods§
fn strong_count(typ: &Self) -> usize
Provided Methods§
sourcefn type_field_iter(&self) -> TypeFieldIterator<'_, Self> ⓘ
fn type_field_iter(&self) -> TypeFieldIterator<'_, Self> ⓘ
Returns an iterator over all type fields in a record.
{ Test, Test2, x, y } => [Test, Test2]
fn arg_iter(&self) -> ArgIterator<'_, Self> ⓘ
fn implicit_arg_iter(&self) -> ImplicitArgIterator<'_, Self> ⓘ
sourcefn row_iter(&self) -> RowIterator<'_, Self> ⓘ
fn row_iter(&self) -> RowIterator<'_, Self> ⓘ
Returns an iterator over all fields in a record.
{ Test, Test2, x, y } => [x, y]
fn remove_implicit_args<'a>(&'a self) -> &'a Self
fn remove_forall<'a>(&'a self) -> &'a Self
fn remove_forall_and_implicit_args<'a>(&'a self) -> &'a Self
fn replace_generics( &self, interner: &mut impl TypeContext<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Option<Self>
fn replace_generics_( &self, interner: &mut impl TypeContext<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Option<Self>
fn forall_scope_iter(&self) -> ForallScopeIter<'_, Self> ⓘ
fn pretty<'a, A>( &'a self, arena: &'a Arena<'a, A> ) -> DocBuilder<'a, Arena<'a, A>, A>
sourcefn apply_args<'a>(
&self,
params: &[Generic<Self::Id>],
args: &'a [Self],
interner: &mut impl TypeContext<Self::Id, Self>,
named_variables: &mut FnvMap<Self::Id, Self>
) -> Option<Self>
fn apply_args<'a>( &self, params: &[Generic<Self::Id>], args: &'a [Self], interner: &mut impl TypeContext<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Option<Self>
Applies a list of arguments to a parameterised type, returning Some
if the substitution was successful.
Example:
self = forall e t . | Err e | Ok t
args = [Error, Option a]
result = | Err Error | Ok (Option a)
fn arg_application<'a>( &self, params: &[Generic<Self::Id>], args: &'a [Self], interner: &mut impl TypeContext<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Option<(Self, &'a [Self])>
fn instantiate_generics( &self, interner: &mut impl Substitution<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Self
fn skolemize( &self, interner: &mut impl Substitution<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self> ) -> Self
fn skolemize_in( &self, interner: &mut impl Substitution<Self::Id, Self>, named_variables: &mut FnvMap<Self::Id, Self>, f: impl FnOnce(Self) -> Self ) -> Self
Object Safety§
This trait is not object safe.