Enum Type

Source
pub enum Type<'a> {
Show 19 variants U8(SourceSpan), S8(SourceSpan), U16(SourceSpan), S16(SourceSpan), U32(SourceSpan), S32(SourceSpan), U64(SourceSpan), S64(SourceSpan), F32(SourceSpan), F64(SourceSpan), Char(SourceSpan), Bool(SourceSpan), String(SourceSpan), Tuple(Vec<Type<'a>>, SourceSpan), List(Box<Type<'a>>, SourceSpan), Option(Box<Type<'a>>, SourceSpan), Result { ok: Option<Box<Type<'a>>>, err: Option<Box<Type<'a>>>, span: SourceSpan, }, Borrow(Ident<'a>, SourceSpan), Ident(Ident<'a>),
}
Expand description

Represents a type in the AST.

Variants§

§

U8(SourceSpan)

A u8 type.

§

S8(SourceSpan)

A s8 type.

§

U16(SourceSpan)

A u16 type.

§

S16(SourceSpan)

A s16 type.

§

U32(SourceSpan)

A u32 type.

§

S32(SourceSpan)

A s32 type.

§

U64(SourceSpan)

A u64 type.

§

S64(SourceSpan)

A s64 type.

§

F32(SourceSpan)

A f32 type.

§

F64(SourceSpan)

A f64 type.

§

Char(SourceSpan)

A char type.

§

Bool(SourceSpan)

A bool type.

§

String(SourceSpan)

A string type.

§

Tuple(Vec<Type<'a>>, SourceSpan)

A tuple type.

§

List(Box<Type<'a>>, SourceSpan)

A list type.

§

Option(Box<Type<'a>>, SourceSpan)

An option type.

§

Result

A result type.

Fields

§ok: Option<Box<Type<'a>>>

The ok of the result type.

§err: Option<Box<Type<'a>>>

The err of the result type.

§span: SourceSpan

The span of the result type.

§

Borrow(Ident<'a>, SourceSpan)

A borrow type.

§

Ident(Ident<'a>)

An identifier to a value type.

Implementations§

Source§

impl Type<'_>

Source

pub fn span(&self) -> SourceSpan

Gets the span of the type.

Trait Implementations§

Source§

impl<'a> Clone for Type<'a>

Source§

fn clone(&self) -> Type<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Type<'a>

Source§

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

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

impl<'a> Serialize for Type<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Type<'a>

§

impl<'a> RefUnwindSafe for Type<'a>

§

impl<'a> Send for Type<'a>

§

impl<'a> Sync for Type<'a>

§

impl<'a> Unpin for Type<'a>

§

impl<'a> UnwindSafe for Type<'a>

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, 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<T> ErasedDestructor for T
where T: 'static,