Struct gluon_base::types::TypeCache

source ·
pub struct TypeCache<Id, T>
where T: TypeExt<Id = Id>, T::Types: Default + Extend<T>,
{
Show 13 fields pub kind_cache: KindCache, pub hole: T, pub opaque: T, pub error: T, pub int: T, pub byte: T, pub float: T, pub string: T, pub char: T, pub function_builtin: T, pub array_builtin: T, pub unit: T, pub empty_row: T, /* private fields */
}

Fields§

§kind_cache: KindCache§hole: T§opaque: T§error: T§int: T§byte: T§float: T§string: T§char: T§function_builtin: T§array_builtin: T§unit: T§empty_row: T

Implementations§

source§

impl<Id, T> TypeCache<Id, T>
where T: From<Type<Id, T>> + TypeExt<Id = Id>, T::Types: Default + Extend<T>,

source

pub fn new() -> Self

source§

impl<Id, T> TypeCache<Id, T>
where T: Clone + TypeExt<Id = Id>, T::Types: Default + Extend<T>,

source

pub fn hole(&self) -> T

source

pub fn opaque(&self) -> T

source

pub fn error(&self) -> T

source

pub fn int(&self) -> T

source

pub fn byte(&self) -> T

source

pub fn float(&self) -> T

source

pub fn string(&self) -> T

source

pub fn char(&self) -> T

source

pub fn function_builtin(&self) -> T

source

pub fn array_builtin(&self) -> T

source

pub fn unit(&self) -> T

source

pub fn empty_row(&self) -> T

source§

impl<Id, T> TypeCache<Id, T>
where T: TypeExt<Id = Id> + From<Type<Id, T>> + Clone, T::Types: Default + Extend<T>,

source

pub fn function<I>(&self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source

pub fn function_implicit<I>(&self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source

pub fn tuple<S, I>(&self, symbols: &mut S, elems: I) -> T
where S: ?Sized + IdentEnv<Ident = Id>, T::SpannedId: From<Id>, I: IntoIterator<Item = T>,

source

pub fn variant(&self, fields: Vec<Field<T::SpannedId, T>>) -> T

source

pub fn poly_variant(&self, fields: Vec<Field<T::SpannedId, T>>, rest: T) -> T

source

pub fn record( &self, types: Vec<Field<T::SpannedId, Alias<Id, T>>>, fields: Vec<Field<T::SpannedId, T>> ) -> T

source

pub fn effect(&self, fields: Vec<Field<T::SpannedId, T>>) -> T

source

pub fn poly_effect(&self, fields: Vec<Field<T::SpannedId, T>>, rest: T) -> T

source

pub fn array(&self, typ: T) -> T

source§

impl<Id, T> TypeCache<Id, T>
where T: TypeExt<Id = Id> + Clone, T::Types: Default + Extend<T> + FromIterator<T>,

source

pub fn builtin_type(&self, typ: BuiltinType) -> T

Trait Implementations§

source§

impl<Id: Clone, T> Clone for TypeCache<Id, T>
where T: TypeExt<Id = Id> + Clone, T::Types: Default + Extend<T>,

source§

fn clone(&self) -> TypeCache<Id, 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
source§

impl<Id: Debug, T> Debug for TypeCache<Id, T>
where T: TypeExt<Id = Id> + Debug, T::Types: Default + Extend<T>,

source§

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

Formats the value using the given formatter. Read more
source§

impl<Id, T> Default for TypeCache<Id, T>
where T: From<Type<Id, T>> + TypeExt<Id = Id>, T::Types: Default + Extend<T>,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a, Id, T> TypeContext<Id, T> for &'a TypeCache<Id, T>
where T: TypeExt<Id = Id> + From<(Type<Id, T>, Flags)> + From<Type<Id, T>> + Clone, T::Types: Default + Extend<T> + FromIterator<T>, T::Generics: FromIterator<Generic<Id>>, T::Fields: FromIterator<Field<T::SpannedId, T>>, T::TypeFields: FromIterator<Field<T::SpannedId, Alias<Id, T>>>,

source§

fn intern(&mut self, typ: Type<Id, T>) -> T

source§

fn intern_types(&mut self, types: impl IntoIterator<Item = T>) -> T::Types

source§

fn intern_generics( &mut self, types: impl IntoIterator<Item = Generic<Id>> ) -> T::Generics

source§

fn intern_fields( &mut self, types: impl IntoIterator<Item = Field<T::SpannedId, T>> ) -> T::Fields

source§

fn intern_type_fields( &mut self, types: impl IntoIterator<Item = Field<T::SpannedId, Alias<Id, T>>> ) -> T::TypeFields

source§

fn intern_flags(&mut self, typ: Type<Id, T>, flags: Flags) -> T

source§

fn hole(&mut self) -> T

source§

fn opaque(&mut self) -> T

source§

fn error(&mut self) -> T

source§

fn int(&mut self) -> T

source§

fn byte(&mut self) -> T

source§

fn float(&mut self) -> T

source§

fn string(&mut self) -> T

source§

fn char(&mut self) -> T

source§

fn function_builtin(&mut self) -> T

source§

fn array_builtin(&mut self) -> T

source§

fn unit(&mut self) -> T

source§

fn empty_row(&mut self) -> T

source§

fn builtin(&mut self, typ: BuiltinType) -> T

source§

fn forall(&mut self, params: T::Generics, typ: T) -> T

source§

fn array(&mut self, typ: T) -> T

source§

fn app(&mut self, id: T, args: T::Types) -> T

source§

fn variant(&mut self, fields: T::Fields) -> T

source§

fn poly_variant(&mut self, fields: T::Fields, rest: T) -> T

source§

fn effect(&mut self, fields: T::Fields) -> T

source§

fn poly_effect(&mut self, fields: T::Fields, rest: T) -> T

source§

fn record(&mut self, types: T::TypeFields, fields: T::Fields) -> T

source§

fn poly_record(&mut self, types: T::TypeFields, fields: T::Fields, rest: T) -> T

source§

fn extend_full_row( &mut self, types: T::TypeFields, fields: T::Fields, rest: T ) -> T

source§

fn extend_row(&mut self, fields: T::Fields, rest: T) -> T

source§

fn extend_type_row(&mut self, types: T::TypeFields, rest: T) -> T

source§

fn function<I>(&mut self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn function_implicit<I>(&mut self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn function_type<I>(&mut self, arg_type: ArgType, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn generic(&mut self, typ: Generic<Id>) -> T

source§

fn skolem(&mut self, typ: Skolem<Id>) -> T

source§

fn variable(&mut self, typ: TypeVariable) -> T

source§

fn alias(&mut self, name: Id, args: T::Generics, typ: T) -> T

source§

fn ident(&mut self, id: KindedIdent<Id>) -> T

source§

fn projection(&mut self, id: AppVec<Id>) -> T

source§

fn builtin_type(&mut self, typ: BuiltinType) -> T

source§

fn new_alias(&mut self, name: Id, args: T::Generics, typ: T) -> Alias<Id, T>

source§

fn new_data_alias(&mut self, data: AliasData<Id, T>) -> Alias<Id, T>

source§

impl<Id, T> TypeContext<Id, T> for TypeCache<Id, T>
where T: TypeExt<Id = Id> + From<(Type<Id, T>, Flags)> + From<Type<Id, T>> + Clone, T::Types: Default + Extend<T> + FromIterator<T>, T::Generics: FromIterator<Generic<Id>>, T::Fields: FromIterator<Field<T::SpannedId, T>>, T::TypeFields: FromIterator<Field<T::SpannedId, Alias<Id, T>>>,

source§

fn intern(&mut self, typ: Type<Id, T>) -> T

source§

fn intern_types(&mut self, types: impl IntoIterator<Item = T>) -> T::Types

source§

fn intern_generics( &mut self, types: impl IntoIterator<Item = Generic<Id>> ) -> T::Generics

source§

fn intern_fields( &mut self, types: impl IntoIterator<Item = Field<T::SpannedId, T>> ) -> T::Fields

source§

fn intern_type_fields( &mut self, types: impl IntoIterator<Item = Field<T::SpannedId, Alias<Id, T>>> ) -> T::TypeFields

source§

fn intern_flags(&mut self, typ: Type<Id, T>, flags: Flags) -> T

source§

fn hole(&mut self) -> T

source§

fn opaque(&mut self) -> T

source§

fn error(&mut self) -> T

source§

fn int(&mut self) -> T

source§

fn byte(&mut self) -> T

source§

fn float(&mut self) -> T

source§

fn string(&mut self) -> T

source§

fn char(&mut self) -> T

source§

fn function_builtin(&mut self) -> T

source§

fn array_builtin(&mut self) -> T

source§

fn unit(&mut self) -> T

source§

fn empty_row(&mut self) -> T

source§

fn builtin(&mut self, typ: BuiltinType) -> T

source§

fn forall(&mut self, params: T::Generics, typ: T) -> T

source§

fn array(&mut self, typ: T) -> T

source§

fn app(&mut self, id: T, args: T::Types) -> T

source§

fn variant(&mut self, fields: T::Fields) -> T

source§

fn poly_variant(&mut self, fields: T::Fields, rest: T) -> T

source§

fn effect(&mut self, fields: T::Fields) -> T

source§

fn poly_effect(&mut self, fields: T::Fields, rest: T) -> T

source§

fn record(&mut self, types: T::TypeFields, fields: T::Fields) -> T

source§

fn poly_record(&mut self, types: T::TypeFields, fields: T::Fields, rest: T) -> T

source§

fn extend_full_row( &mut self, types: T::TypeFields, fields: T::Fields, rest: T ) -> T

source§

fn extend_row(&mut self, fields: T::Fields, rest: T) -> T

source§

fn extend_type_row(&mut self, types: T::TypeFields, rest: T) -> T

source§

fn function<I>(&mut self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn function_implicit<I>(&mut self, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn function_type<I>(&mut self, arg_type: ArgType, args: I, ret: T) -> T
where I: IntoIterator<Item = T>, I::IntoIter: DoubleEndedIterator<Item = T>,

source§

fn generic(&mut self, typ: Generic<Id>) -> T

source§

fn skolem(&mut self, typ: Skolem<Id>) -> T

source§

fn variable(&mut self, typ: TypeVariable) -> T

source§

fn alias(&mut self, name: Id, args: T::Generics, typ: T) -> T

source§

fn ident(&mut self, id: KindedIdent<Id>) -> T

source§

fn projection(&mut self, id: AppVec<Id>) -> T

source§

fn builtin_type(&mut self, typ: BuiltinType) -> T

source§

fn new_alias(&mut self, name: Id, args: T::Generics, typ: T) -> Alias<Id, T>

source§

fn new_data_alias(&mut self, data: AliasData<Id, T>) -> Alias<Id, T>

Auto Trait Implementations§

§

impl<Id, T> RefUnwindSafe for TypeCache<Id, T>

§

impl<Id, T> Send for TypeCache<Id, T>
where Id: Send, T: Send,

§

impl<Id, T> Sync for TypeCache<Id, T>
where Id: Sync, T: Sync,

§

impl<Id, T> Unpin for TypeCache<Id, T>
where Id: Unpin, T: Unpin,

§

impl<Id, T> UnwindSafe for TypeCache<Id, T>
where Id: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<Id> AsId<Id> for Id
where Id: ?Sized,

source§

fn as_id(&self) -> &Id

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Any for T
where T: Any,

§

impl<T> CloneAny for T
where T: Any + Clone,