[][src]Trait gluon_base::types::TypeExt

pub trait TypeExt: TypePtr<Types = AppVec<Self>, Generics = Vec<Generic<Self::Id>>, Fields = Vec<Field<Self::SpannedId, Self>>, TypeFields = Vec<Field<Self::SpannedId, Alias<Self::Id, Self>>>> + Clone + Sized {
    fn strong_count(typ: &Self) -> usize;

    fn type_field_iter(&self) -> TypeFieldIterator<'_, Self>

Notable traits for TypeFieldIterator<'a, T>

impl<'a, Id: 'a, T> Iterator for TypeFieldIterator<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Field<T::SpannedId, Alias<Id, T>>;
{ ... }
fn arg_iter(&self) -> ArgIterator<'_, Self>

Notable traits for ArgIterator<'a, T>

impl<'a, Id, T> Iterator for ArgIterator<'a, T> where
    Id: 'a,
    T: TypePtr<Id = Id>, 
type Item = &'a T;
{ ... }
fn implicit_arg_iter(&self) -> ImplicitArgIterator<'_, Self>

Notable traits for ImplicitArgIterator<'a, T>

impl<'a, Id, T> Iterator for ImplicitArgIterator<'a, T> where
    Id: 'a,
    T: TypePtr<Id = Id>, 
type Item = &'a T;
{ ... }
fn row_iter(&self) -> RowIterator<'_, Self>

Notable traits for RowIterator<'a, T>

impl<'a, Id: 'a, T> Iterator for RowIterator<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Field<T::SpannedId, T>;
{ ... }
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>

Notable traits for ForallScopeIter<'a, T>

impl<'a, T, Id: 'a> Iterator for ForallScopeIter<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Generic<Id>;
{ ... }
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,
        Self::SpannedId: Clone,
        Self: Display,
        Self::Id: 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,
        Self: Display,
        Self::Id: 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

Loading content...

Provided methods

fn type_field_iter(&self) -> TypeFieldIterator<'_, Self>

Notable traits for TypeFieldIterator<'a, T>

impl<'a, Id: 'a, T> Iterator for TypeFieldIterator<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Field<T::SpannedId, Alias<Id, T>>;

Returns an iterator over all type fields in a record. { Test, Test2, x, y } => [Test, Test2]

fn arg_iter(&self) -> ArgIterator<'_, Self>

Notable traits for ArgIterator<'a, T>

impl<'a, Id, T> Iterator for ArgIterator<'a, T> where
    Id: 'a,
    T: TypePtr<Id = Id>, 
type Item = &'a T;

fn implicit_arg_iter(&self) -> ImplicitArgIterator<'_, Self>

Notable traits for ImplicitArgIterator<'a, T>

impl<'a, Id, T> Iterator for ImplicitArgIterator<'a, T> where
    Id: 'a,
    T: TypePtr<Id = Id>, 
type Item = &'a T;

fn row_iter(&self) -> RowIterator<'_, Self>

Notable traits for RowIterator<'a, T>

impl<'a, Id: 'a, T> Iterator for RowIterator<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Field<T::SpannedId, T>;

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> 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>

Notable traits for ForallScopeIter<'a, T>

impl<'a, T, Id: 'a> Iterator for ForallScopeIter<'a, T> where
    T: TypePtr<Id = Id>, 
type Item = &'a Generic<Id>;

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,
    Self::SpannedId: Clone,
    Self: Display,
    Self::Id: Display,
    Self::Types: Clone + FromIterator<Self>,
    Self::Generics: Clone,
    Self::Fields: Clone

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])> where
    Self::Id: Clone + Eq + Hash,
    Self: Display,
    Self::Id: 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

Loading content...

Implementors

impl<Id> TypeExt for ArcType<Id>[src]

Loading content...