Enum Item

enum Item

Things that can appear directly inside of a module or scope.

Syntax tree enum

This type is a syntax tree enum.

Variants

Const(ItemConst)

A constant item: const MAX: u16 = 65535.

Enum(ItemEnum)

An enum definition: enum Foo<A, B> { A(A), B(B) }.

ExternCrate(ItemExternCrate)

An extern crate item: extern crate serde.

Fn(ItemFn)

A free-standing function: fn process(n: usize) -> Result<()> { ... }.

ForeignMod(ItemForeignMod)

A block of foreign items: extern "C" { ... }.

Impl(ItemImpl)

An impl block providing trait or associated items: impl<A> Trait for Data<A> { ... }.

Macro(ItemMacro)

A macro invocation, which includes macro_rules! definitions.

Mod(ItemMod)

A module or module declaration: mod m or mod m { ... }.

Static(ItemStatic)

A static item: static BIKE: Shed = Shed(42).

Struct(ItemStruct)

A struct definition: struct Foo<A> { x: A }.

Trait(ItemTrait)

A trait definition: pub trait Iterator { ... }.

TraitAlias(ItemTraitAlias)

A trait alias: pub trait SharableIterator = Iterator + Sync.

Type(ItemType)

A type alias: type Result<T> = std::result::Result<T, MyError>.

Union(ItemUnion)

A union definition: union Foo<A, B> { x: A, y: B }.

Use(ItemUse)

A use declaration: use std::collections::HashMap.

Verbatim(proc_macro2::TokenStream)

Tokens forming an item not interpreted by Syn.

Implementations

impl Clone for Item

fn clone(self: &Self) -> Self

impl Debug for Item

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

impl Eq for Item

impl Freeze for Item

impl From for Item

fn from(e: ItemEnum) -> Item

impl From for Item

fn from(e: ItemMacro) -> Item

impl From for Item

fn from(e: ItemTraitAlias) -> Item

impl From for Item

fn from(e: ItemFn) -> Item

impl From for Item

fn from(e: ItemStatic) -> Item

impl From for Item

fn from(e: ItemUnion) -> Item

impl From for Item

fn from(e: ItemConst) -> Item

impl From for Item

fn from(e: ItemImpl) -> Item

impl From for Item

fn from(e: ItemTrait) -> Item

impl From for Item

fn from(e: ItemExternCrate) -> Item

impl From for Item

fn from(e: ItemMod) -> Item

impl From for Item

fn from(e: ItemType) -> Item

impl From for Item

fn from(e: ItemForeignMod) -> Item

impl From for Item

fn from(input: DeriveInput) -> Item

impl From for Item

fn from(e: ItemStruct) -> Item

impl From for Item

fn from(e: ItemUse) -> Item

impl Hash for Item

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

impl Parse for Item

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

impl PartialEq for Item

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

impl RefUnwindSafe for Item

impl Send for Item

impl Sync for Item

impl ToTokens for Item

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

impl Unpin for Item

impl UnsafeUnpin for Item

impl UnwindSafe for Item

impl<T> Any for Item

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Item

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

impl<T> BorrowMut for Item

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

impl<T> CloneToUninit for Item

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

impl<T> From for Item

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Item

fn span(self: &Self) -> Span

impl<T> ToOwned for Item

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

impl<T, U> Into for Item

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 Item

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

impl<T, U> TryInto for Item

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