Struct gluon_base::types::ArcType
source · pub struct ArcType<Id = Symbol> { /* private fields */ }
Expand description
A shared type which is atomically reference counted
Implementations
sourceimpl<Id> ArcType<Id>
impl<Id> ArcType<Id>
pub fn new(typ: Type<Id, ArcType<Id>>) -> ArcType<Id>
sourcepub fn type_field_iter(&self) -> TypeFieldIterator<'_, Self> ⓘ
pub fn type_field_iter(&self) -> TypeFieldIterator<'_, Self> ⓘ
Returns an iterator over all type fields in a record.
{ Test, Test2, x, y } => [Test, Test2]
sourcepub fn row_iter(&self) -> RowIterator<'_, Self> ⓘ
pub fn row_iter(&self) -> RowIterator<'_, Self> ⓘ
Returns an iterator over all fields in a record.
{ Test, Test2, x, y } => [x, y]
pub fn strong_count(typ: &ArcType<Id>) -> usize
pub fn remove_implicit_args(&self) -> &ArcType<Id>
pub fn forall_params_vars(
&self
) -> impl Iterator<Item = (&Generic<Id>, &ArcType<Id>)>
pub fn forall_params(&self) -> impl Iterator<Item = &Generic<Id>>
pub fn remove_forall(&self) -> &ArcType<Id>
pub fn remove_forall_and_implicit_args(&self) -> &ArcType<Id>
pub fn skolemize_in(
&self,
named_variables: &mut FnvMap<Id, ArcType<Id>>,
f: impl FnOnce(ArcType<Id>) -> ArcType<Id>
) -> ArcType<Id>where
Id: Clone + Eq + Hash,
pub fn with_forall(self, from: &Self) -> Selfwhere
Id: Clone + Eq + Hash,
pub fn skolemize(
&self,
named_variables: &mut FnvMap<Id, ArcType<Id>>
) -> ArcType<Id>where
Id: Clone + Eq + Hash,
pub fn instantiate_generics(
&self,
named_variables: &mut FnvMap<Id, ArcType<Id>>
) -> ArcType<Id>where
Id: Clone + Eq + Hash,
pub fn instantiate_generics_(
&self,
named_variables: &FnvMap<Id, ArcType<Id>>
) -> Option<ArcType<Id>>where
Id: Clone + Eq + Hash,
pub fn forall_scope_iter(&self) -> ForallScopeIter<'_, Id> ⓘ
pub fn pretty<'a, A>(
&'a self,
arena: &'a Arena<'a, A>
) -> DocBuilder<'a, Arena<'a, A>, A>where
Id: AsRef<str>,
A: Clone,
pub fn display<A>(&self, width: usize) -> TypeFormatter<'_, Id, Self, A>
sourceimpl ArcType
impl ArcType
sourcepub fn apply_args(
&self,
params: &[Generic<Symbol>],
args: &[ArcType]
) -> Option<ArcType>
pub fn apply_args(
&self,
params: &[Generic<Symbol>],
args: &[ArcType]
) -> Option<ArcType>
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)
Methods from Deref<Target = Type<Id, ArcType<Id>>>
pub fn as_variable(&self) -> Option<&TypeVariable>
pub fn as_function(&self) -> Option<(&T, &T)>
pub fn as_explicit_function(&self) -> Option<(&T, &T)>
pub fn as_function_with_type(&self) -> Option<(ArgType, &T, &T)>
pub fn unapplied_args(&self) -> Cow<'_, [T]>where
T: Clone,
pub fn alias_ident(&self) -> Option<&Id>
pub fn applied_alias(&self) -> Option<&AliasRef<Id, T>>
pub fn is_non_polymorphic_record(&self) -> bool
pub fn params(&self) -> &[Generic<Id>]
pub fn kind(&self) -> Cow<'_, ArcKind>
Trait Implementations
sourceimpl<Id: PartialEq> PartialEq<ArcType<Id>> for ArcType<Id>
impl<Id: PartialEq> PartialEq<ArcType<Id>> for ArcType<Id>
sourceimpl<'a, I, A> ToDoc<'a, Arena<Doc<'a, RefDoc<'a, A>, A>>, A, &'a (dyn Source + 'a)> for ArcType<I>where
I: AsRef<str>,
A: Clone,
impl<'a, I, A> ToDoc<'a, Arena<Doc<'a, RefDoc<'a, A>, A>>, A, &'a (dyn Source + 'a)> for ArcType<I>where
I: AsRef<str>,
A: Clone,
sourceimpl<'a, I, A> ToDoc<'a, Arena<Doc<'a, RefDoc<'a, A>, A>>, A, ()> for ArcType<I>where
I: AsRef<str>,
A: Clone,
impl<'a, I, A> ToDoc<'a, Arena<Doc<'a, RefDoc<'a, A>, A>>, A, ()> for ArcType<I>where
I: AsRef<str>,
A: Clone,
impl<Id: Eq> Eq for ArcType<Id>
impl<Id> StableDeref for ArcType<Id>
impl<Id> StructuralEq for ArcType<Id>
impl<Id> StructuralPartialEq for ArcType<Id>
Auto Trait Implementations
impl<Id> RefUnwindSafe for ArcType<Id>where
Id: RefUnwindSafe,
impl<Id> Send for ArcType<Id>where
Id: Send + Sync,
impl<Id> Sync for ArcType<Id>where
Id: Send + Sync,
impl<Id> Unpin for ArcType<Id>
impl<Id> UnwindSafe for ArcType<Id>where
Id: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more