Enum Type

enum Type

The possible types that a Rust value could have.

Syntax tree enum

This type is a syntax tree enum.

Variants

Array(TypeArray)

A fixed size array type: [T; n].

BareFn(TypeBareFn)

A bare function type: fn(usize) -> bool.

Group(TypeGroup)

A type contained within invisible delimiters.

ImplTrait(TypeImplTrait)

An impl Bound1 + Bound2 + Bound3 type where Bound is a trait or a lifetime.

Infer(TypeInfer)

Indication that a type should be inferred by the compiler: _.

Macro(TypeMacro)

A macro in the type position.

Never(TypeNever)

The never type: !.

Paren(TypeParen)

A parenthesized type equivalent to the inner type.

Path(TypePath)

A path like std::slice::Iter, optionally qualified with a self-type as in <Vec<T> as SomeTrait>::Associated.

Ptr(TypePtr)

A raw pointer type: *const T or *mut T.

Reference(TypeReference)

A reference type: &'a T or &'a mut T.

Slice(TypeSlice)

A dynamically sized slice type: [T].

TraitObject(TypeTraitObject)

A trait object type dyn Bound1 + Bound2 + Bound3 where Bound is a trait or a lifetime.

Tuple(TypeTuple)

A tuple type: (A, B, C, String).

Verbatim(proc_macro2::TokenStream)

Tokens in type position not interpreted by Syn.

Implementations

impl Type

fn without_plus(input: ParseStream<'_>) -> Result<Self>

In some positions, types may not contain the + character, to disambiguate them. For example in the expression 1 as T, T may not contain a + character.

This parser does not allow a +, while the default parser does.

impl Clone for Type

fn clone(self: &Self) -> Self

impl Debug for Type

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

impl Eq for Type

impl Freeze for Type

impl From for Type

fn from(e: TypeArray) -> Type

impl From for Type

fn from(e: TypeMacro) -> Type

impl From for Type

fn from(e: TypeReference) -> Type

impl From for Type

fn from(e: TypeGroup) -> Type

impl From for Type

fn from(e: TypeParen) -> Type

impl From for Type

fn from(e: TypeTraitObject) -> Type

impl From for Type

fn from(e: TypeInfer) -> Type

impl From for Type

fn from(e: TypePtr) -> Type

impl From for Type

fn from(e: TypeBareFn) -> Type

impl From for Type

fn from(e: TypeNever) -> Type

impl From for Type

fn from(e: TypeSlice) -> Type

impl From for Type

fn from(e: TypeImplTrait) -> Type

impl From for Type

fn from(e: TypePath) -> Type

impl From for Type

fn from(e: TypeTuple) -> Type

impl Hash for Type

fn hash<H>(self: &Self, state: &mut H)
where
    H: Hasher

impl Parse for Type

fn parse(input: ParseStream<'_>) -> Result<Self>

impl PartialEq for Type

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

impl RefUnwindSafe for Type

impl Send for Type

impl Sync for Type

impl ToTokens for Type

fn to_tokens(self: &Self, tokens: &mut TokenStream)

impl Unpin for Type

impl UnsafeUnpin for Type

impl UnwindSafe for Type

impl<T> Any for Type

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Type

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Type

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Type

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

impl<T> From for Type

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Type

fn span(self: &Self) -> Span

impl<T> ToOwned for Type

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Type

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Type

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Type

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>