pub enum Type {
Show 14 variants
Bottom,
Any,
Primitive(BitFlags<Typ>),
Ref {
scope: ModPath,
name: ModPath,
params: Arc<[Type]>,
},
Fn(Arc<FnType>),
Set(Arc<[Type]>),
TVar(TVar),
Error(Arc<Type>),
Array(Arc<Type>),
ByRef(Arc<Type>),
Tuple(Arc<[Type]>),
Struct(Arc<[(ArcStr, Type)]>),
Variant(ArcStr, Arc<[Type]>),
Map {
key: Arc<Type>,
value: Arc<Type>,
},
}Variants§
Bottom
Any
Primitive(BitFlags<Typ>)
Ref
Fn(Arc<FnType>)
Set(Arc<[Type]>)
TVar(TVar)
Error(Arc<Type>)
Array(Arc<Type>)
ByRef(Arc<Type>)
Tuple(Arc<[Type]>)
Struct(Arc<[(ArcStr, Type)]>)
Variant(ArcStr, Arc<[Type]>)
Map
Implementations§
Source§impl Type
impl Type
pub fn empty_tvar() -> Self
pub fn is_defined(&self) -> bool
pub fn lookup_ref<'a, R: Rt, E: UserEvent>( &'a self, env: &'a Env<R, E>, ) -> Result<&'a Type>
pub fn check_contains<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, t: &Self, ) -> Result<()>
pub fn contains<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, t: &Self, ) -> Result<bool>
pub fn contains_with_flags<R: Rt, E: UserEvent>( &self, flags: BitFlags<ContainsFlags>, env: &Env<R, E>, t: &Self, ) -> Result<bool>
pub fn could_match<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, t: &Self, ) -> Result<bool>
pub fn union<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, t: &Self, ) -> Result<Self>
pub fn diff<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, t: &Self, ) -> Result<Self>
pub fn any() -> Self
pub fn boolean() -> Self
pub fn number() -> Self
pub fn int() -> Self
pub fn uint() -> Self
Sourcepub fn alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
pub fn alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
alias type variables with the same name to each other
pub fn collect_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
pub fn check_tvars_declared(&self, declared: &FxHashSet<ArcStr>) -> Result<()>
pub fn has_unbound(&self) -> bool
Sourcepub fn reset_tvars(&self) -> Type
pub fn reset_tvars(&self) -> Type
return a copy of self with all type variables unbound and unaliased. self will not be modified
Sourcepub fn replace_tvars(&self, known: &FxHashMap<ArcStr, Self>) -> Type
pub fn replace_tvars(&self, known: &FxHashMap<ArcStr, Self>) -> Type
return a copy of self with every TVar named in known replaced with the corresponding type
Sourcepub fn strip_error<R: Rt, E: UserEvent>(&self, env: &Env<R, E>) -> Option<Self>
pub fn strip_error<R: Rt, E: UserEvent>(&self, env: &Env<R, E>) -> Option<Self>
remove the outer error type and return the inner payload, fail if self isn’t an error or contains non error types
pub fn check_cast<R: Rt, E: UserEvent>(&self, env: &Env<R, E>) -> Result<()>
pub fn cast_value<R: Rt, E: UserEvent>( &self, env: &Env<R, E>, v: Value, ) -> Value
Sourcepub fn is_a<R: Rt, E: UserEvent>(&self, env: &Env<R, E>, v: &Value) -> bool
pub fn is_a<R: Rt, E: UserEvent>(&self, env: &Env<R, E>, v: &Value) -> bool
return true if v is structurally compatible with the type
pub fn is_bot(&self) -> bool
pub fn with_deref<R, F: FnOnce(Option<&Self>) -> R>(&self, f: F) -> R
pub fn scope_refs(&self, scope: &ModPath) -> Type
Trait Implementations§
Source§impl Ord for Type
impl Ord for Type
Source§impl PartialOrd for Type
impl PartialOrd for Type
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl !RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more