TyRepr

Enum TyRepr 

Source
pub enum TyRepr {
    Con {
        name: Arc<str>,
        kind: TyKind,
        args: Vec<TyRepr>,
    },
    Param {
        name: Arc<str>,
        index: usize,
    },
    Fun {
        params: Vec<TyRepr>,
        result: Box<TyRepr>,
    },
    Unknown,
}
Expand description

The type of an expression, as a macro body sees it.

A projection of the checker’s Ty rather than the thing itself: this crate must not depend on the type checker, which depends on it. What is dropped is what a macro has no use for — a function’s effect row, and the identity of a unification variable.

Variants§

§

Con

A named type applied to arguments: Int, list[Str], Todo.

Fields

§name: Arc<str>
§kind: TyKind
§args: Vec<TyRepr>
§

Param

A declaration’s own type parameter, seen while looking into that declaration — the T of model Box[T]. Substituted away by TypeEnv::fields when the type being looked into carries arguments, so a body meets one only where the type it asked about was generic.

Fields

§name: Arc<str>
§index: usize
§

Fun

Fields

§params: Vec<TyRepr>
§result: Box<TyRepr>
§

Unknown

Inference had no answer here — an argument whose type is still open, or one whose own checking failed.

Implementations§

Source§

impl TyRepr

Source

pub fn kind_name(&self) -> &'static str

Source

pub fn head(&self) -> Arc<str>

The head, with no arguments — what a body matches on.

Source

pub fn args(&self) -> Vec<TyRepr>

Trait Implementations§

Source§

impl Clone for TyRepr

Source§

fn clone(&self) -> TyRepr

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 TyRepr

Source§

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

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

impl Display for TyRepr

Source§

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

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

impl PartialEq for TyRepr

Source§

fn eq(&self, other: &TyRepr) -> 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 StructuralPartialEq for TyRepr

Auto Trait Implementations§

§

impl Freeze for TyRepr

§

impl RefUnwindSafe for TyRepr

§

impl Send for TyRepr

§

impl Sync for TyRepr

§

impl Unpin for TyRepr

§

impl UnwindSafe for TyRepr

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