Struct gluon_base::ast::AstType

source ·
pub struct AstType<'ast, Id> { /* private fields */ }

Implementations§

source§

impl<'ast, Id> AstType<'ast, Id>

source

pub fn new( arena: ArenaRef<'_, 'ast, Id>, typ: Spanned<Type<Id, AstType<'ast, Id>>, BytePos> ) -> Self

source

pub fn new_no_loc( arena: ArenaRef<'_, 'ast, Id>, typ: Type<Id, AstType<'ast, Id>> ) -> Self

source

pub fn with_metadata<T>( arena: ArenaRef<'_, 'ast, Id>, metadata: T, typ: Spanned<Type<Id, AstType<'ast, Id>>, BytePos> ) -> Self
where T: Into<BaseMetadata<'ast>>,

source

pub fn set_metadata<T>(&mut self, metadata: T)
where T: Into<BaseMetadata<'ast>>,

source

pub fn remove_single_forall(&mut self) -> &mut AstType<'ast, Id>

source

pub fn span_mut(&mut self) -> &mut Span<BytePos>

Methods from Deref<Target = Type<Id, AstType<'ast, Id>>>§

source

pub fn as_variable(&self) -> Option<&TypeVariable>

source

pub fn is_array(&self) -> bool

source

pub fn as_function(&self) -> Option<(&T, &T)>

source

pub fn as_explicit_function(&self) -> Option<(&T, &T)>

source

pub fn as_function_with_type(&self) -> Option<(ArgType, &T, &T)>

source

pub fn unapplied_args(&self) -> Cow<'_, [T]>
where T: Clone,

source

pub fn alias_ident(&self) -> Option<&Id>

source

pub fn applied_alias(&self) -> Option<&AliasRef<Id, T>>

source

pub fn is_non_polymorphic_record(&self) -> bool

source

pub fn params(&self) -> &[Generic<Id>]

source

pub fn kind<'k>(&'k self, cache: &'k KindCache) -> Cow<'k, ArcKind>

source

pub fn name(&self) -> Option<&SymbolRef>

Returns the name of self Example: Option a => Option Int => Int

source

pub fn owned_name(&self) -> Option<SymbolKey>

Trait Implementations§

source§

impl<'ast, Id> AsMut<Spanned<Type<Id, AstType<'ast, Id>>, ByteIndex>> for AstType<'ast, Id>

source§

fn as_mut(&mut self) -> &mut SpannedAstType<'ast, Id>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<'ast, Id> AstAlloc<'ast, Id> for AstType<'ast, Id>

source§

fn alloc(self, arena: &'ast Arena<'ast, Id>) -> &'ast mut Self

source§

fn alloc_extend( iter: impl IntoIterator<Item = Self>, arena: &'ast Arena<'ast, Id> ) -> &'ast mut [Self]

source§

impl<'ast, Id> AstClone<'ast, Id> for AstType<'ast, Id>
where Id: AstClone<'ast, Id> + Clone,

source§

fn ast_clone(&self, arena: ArenaRef<'_, 'ast, Id>) -> Self

source§

impl<Id: Debug> Debug for AstType<'_, Id>

source§

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

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

impl<'ast, Id> Deref for AstType<'ast, Id>

§

type Target = Type<Id, AstType<'ast, Id>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'ast, Id> DerefMut for AstType<'ast, Id>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<Id: AsRef<str> + AsId<Id>> Display for AstType<'_, Id>

source§

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

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

impl<Id> HasMetadata for AstType<'_, Id>

source§

impl<Id> HasSpan for AstType<'_, Id>

source§

fn span(&self) -> Span<BytePos>

source§

impl<'ast, Id: PartialEq> PartialEq for AstType<'ast, Id>

source§

fn eq(&self, other: &AstType<'ast, Id>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'ast, Id> TypeContext<Id, AstType<'ast, Id>> for ArenaRef<'_, 'ast, Id>

source§

fn intern(&mut self, typ: Type<Id, AstType<'ast, Id>>) -> AstType<'ast, Id>

source§

fn intern_types( &mut self, types: impl IntoIterator<Item = AstType<'ast, Id>> ) -> &'ast mut [AstType<'ast, Id>]

source§

fn intern_generics( &mut self, types: impl IntoIterator<Item = Generic<Id>> ) -> &'ast mut [Generic<Id>]

source§

fn intern_fields( &mut self, types: impl IntoIterator<Item = Field<Spanned<Id, BytePos>, AstType<'ast, Id>>> ) -> &'ast mut [Field<Spanned<Id, BytePos>, AstType<'ast, Id>>]

source§

fn intern_type_fields( &mut self, types: impl IntoIterator<Item = Field<Spanned<Id, BytePos>, Alias<Id, AstType<'ast, Id>>>> ) -> &'ast mut [Field<Spanned<Id, BytePos>, Alias<Id, AstType<'ast, Id>>>]

source§

fn intern_flags( &mut self, typ: Type<Id, AstType<'ast, Id>>, _flags: Flags ) -> AstType<'ast, Id>

source§

fn hole(&mut self) -> T

source§

fn opaque(&mut self) -> T

source§

fn error(&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 array_builtin(&mut self) -> 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 empty_row(&mut self) -> 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 function_builtin(&mut self) -> T

source§

fn string(&mut self) -> T

source§

fn char(&mut self) -> T

source§

fn byte(&mut self) -> T

source§

fn int(&mut self) -> T

source§

fn float(&mut self) -> T

source§

fn unit(&mut self) -> 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<'ast, Id> TypePtr for AstType<'ast, Id>

§

type Id = Id

§

type SpannedId = Spanned<Id, ByteIndex>

§

type Types = &'ast mut [AstType<'ast, Id>]

§

type Generics = &'ast mut [Generic<Id>]

§

type Fields = &'ast mut [Field<<AstType<'ast, Id> as TypePtr>::SpannedId, AstType<'ast, Id>>]

§

type TypeFields = &'ast mut [Field<<AstType<'ast, Id> as TypePtr>::SpannedId, Alias<Id, AstType<'ast, Id>>>]

source§

fn flags(&self) -> Flags

source§

fn spine(&self) -> &Self

source§

impl<'ast, Id: Eq> Eq for AstType<'ast, Id>

source§

impl<'ast, Id> RefUnwindSafe for AstType<'ast, Id>
where Id: RefUnwindSafe,

source§

impl<'ast, Id> Send for AstType<'ast, Id>
where Id: Send,

source§

impl<'ast, Id> StructuralEq for AstType<'ast, Id>

source§

impl<'ast, Id> StructuralPartialEq for AstType<'ast, Id>

source§

impl<'ast, Id> Sync for AstType<'ast, Id>
where Id: Sync,

Auto Trait Implementations§

§

impl<'ast, Id> Unpin for AstType<'ast, Id>

§

impl<'ast, Id> !UnwindSafe for AstType<'ast, Id>

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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,