Skip to main content

Type

Enum Type 

Source
pub enum Type {
Show 15 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>, }, Abstract { id: AbstractId, params: Arc<[Type]>, },
}

Variants§

§

Bottom

§

Any

§

Primitive(BitFlags<Typ>)

§

Ref

Fields

§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

Fields

§key: Arc<Type>
§value: Arc<Type>
§

Abstract

Fields

§params: Arc<[Type]>

Implementations§

Source§

impl Type

Source

pub fn check_cast(&self, env: &Env) -> Result<()>

Source

pub fn cast_value(&self, env: &Env, v: Value) -> Value

Source

pub fn is_a(&self, env: &Env, v: &Value) -> bool

return true if v is structurally compatible with the type

Source§

impl Type

Source

pub fn check_contains(&self, env: &Env, t: &Self) -> Result<()>

Source

pub fn contains(&self, env: &Env, t: &Self) -> Result<bool>

Source

pub fn contains_with_flags( &self, flags: BitFlags<ContainsFlags>, env: &Env, t: &Self, ) -> Result<bool>

Source§

impl Type

Source

pub fn could_match(&self, env: &Env, t: &Self) -> Result<bool>

Source

pub fn sig_matches( &self, env: &Env, impl_type: &Self, adts: &FxHashMap<AbstractId, Type>, ) -> Result<()>

Source§

impl Type

Source

pub fn union(&self, env: &Env, t: &Self) -> Result<Self>

Source

pub fn diff(&self, env: &Env, t: &Self) -> Result<Self>

Source§

impl Type

Source

pub fn unfreeze_tvars(&self)

Source

pub fn alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)

alias type variables with the same name to each other

Source

pub fn collect_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)

Source

pub fn check_tvars_declared(&self, declared: &FxHashSet<ArcStr>) -> Result<()>

Source

pub fn has_unbound(&self) -> bool

Source

pub fn bind_as(&self, t: &Self)

bind all unbound type variables to the specified type

Source

pub fn reset_tvars(&self) -> Type

return a copy of self with all type variables unbound and unaliased. self will not be modified

Source

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. TVars not in known are replaced with fresh TVars using unique names to avoid entanglement with the caller’s TVars that happen to share the same name.

Source§

impl Type

Source

pub fn empty_tvar() -> Self

Source

pub fn is_defined(&self) -> bool

Source

pub fn lookup_ref(&self, env: &Env) -> Result<Type>

Source

pub fn any() -> Self

Source

pub fn boolean() -> Self

Source

pub fn number() -> Self

Source

pub fn int() -> Self

Source

pub fn uint() -> Self

Source

pub fn strip_error(&self, env: &Env) -> Option<Self>

remove the outer error type and return the inner payload, fail if self isn’t an error or contains non error types

Source

pub fn is_bot(&self) -> bool

Source

pub fn with_deref<R, F: FnOnce(Option<&Self>) -> R>(&self, f: F) -> R

Source

pub fn scope_refs(&self, scope: &ModPath) -> Type

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

Returns a duplicate 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 Debug for Type

Source§

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

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

impl Default for Type

Source§

fn default() -> Self

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

impl Display for Type

Source§

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

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

impl Ord for Type

Source§

fn cmp(&self, other: &Type) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Type

Source§

fn partial_cmp(&self, other: &Type) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrettyDisplay for Type

Source§

fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result

Do the actual pretty print. This should not be called directly, it will be called by fmt_pretty when we know it can’t fit on a single line.
Source§

fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result

This is the user facing fmt method, it will first try to format the expression on a single line, and if that is impossible it will call the pretty printer.
Source§

fn to_string_pretty(&self, limit: usize) -> LPooled<String>

Pretty print to a pooled string
Source§

impl Eq for Type

Source§

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 UnsafeUnpin for Type

§

impl !UnwindSafe for Type

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V