Enum Type

Source
pub enum Type<T: TypeMark> {
    Bottom(PhantomData<T>),
    Primitive(BitFlags<Typ>),
    Ref(ModPath),
    Fn(Arc<FnType<T>>),
    Set(Arc<[Type<T>]>),
    TVar(TVar<T>),
    Array(Arc<Type<T>>),
    Tuple(Arc<[Type<T>]>),
    Struct(Arc<[(ArcStr, Type<T>)]>),
    Variant(ArcStr, Arc<[Type<T>]>),
}

Variants§

§

Bottom(PhantomData<T>)

§

Primitive(BitFlags<Typ>)

§

Ref(ModPath)

§

Fn(Arc<FnType<T>>)

§

Set(Arc<[Type<T>]>)

§

TVar(TVar<T>)

§

Array(Arc<Type<T>>)

§

Tuple(Arc<[Type<T>]>)

§

Struct(Arc<[(ArcStr, Type<T>)]>)

§

Variant(ArcStr, Arc<[Type<T>]>)

Implementations§

Source§

impl Type<NoRefs>

Source

pub fn empty_tvar() -> Self

Source

pub fn is_defined(&self) -> bool

Source

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

Source

pub fn contains(&self, t: &Self) -> bool

Source

pub fn union(&self, t: &Self) -> Self

Source

pub fn diff(&self, t: &Self) -> Self

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 alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar<NoRefs>>)

alias type variables with the same name to each other

Source

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

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

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

return a copy of self with every TVar named in known replaced with the corresponding type

Source

pub fn check_cast(&self) -> Result<()>

Source

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

Source

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

return true if v is structurally compatible with the type

Source§

impl<T: TypeMark> Type<T>

Source

pub fn is_bot(&self) -> bool

Source

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

Source§

impl Type<Refs>

Source

pub fn resolve_typerefs<'a, C: Ctx, E: UserEvent>( &self, scope: &ModPath, env: &Env<C, E>, ) -> Result<Type<NoRefs>>

Trait Implementations§

Source§

impl<T: Clone + TypeMark> Clone for Type<T>

Source§

fn clone(&self) -> Type<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<T: Debug + TypeMark> Debug for Type<T>

Source§

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

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

impl<T: TypeMark> Default for Type<T>

Source§

fn default() -> Self

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

impl<T: TypeMark> Display for Type<T>

Source§

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

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

impl<T: Ord + TypeMark> Ord for Type<T>

Source§

fn cmp(&self, other: &Type<T>) -> 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<T: PartialEq + TypeMark> PartialEq for Type<T>

Source§

fn eq(&self, other: &Type<T>) -> 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<T: PartialOrd + TypeMark> PartialOrd for Type<T>

Source§

fn partial_cmp(&self, other: &Type<T>) -> 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<T: Eq + TypeMark> Eq for Type<T>

Source§

impl<T: TypeMark> StructuralPartialEq for Type<T>

Auto Trait Implementations§

§

impl<T> Freeze for Type<T>

§

impl<T> !RefUnwindSafe for Type<T>

§

impl<T> Send for Type<T>
where T: Send + Sync,

§

impl<T> Sync for Type<T>
where T: Sync + Send,

§

impl<T> Unpin for Type<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Type<T>

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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