Enum ScopeItem

Source
pub enum ScopeItem {
    Enum {
        token: Enum,
        brace: Brace,
        variants: Punctuated<Variant, Comma>,
    },
    Struct {
        token: Struct,
        fields: Fields,
    },
    Type {
        token: Type,
        eq_token: Eq,
        ty: Box<Type>,
    },
    Union {
        token: Union,
        fields: FieldsNamed,
    },
}
Expand description

Content of items supported by Scope that are not common to all variants

Variants§

§

Enum

A syn::ItemEnum, minus common parts

Fields

§token: Enum

enum

§brace: Brace

{ ... }

§variants: Punctuated<Variant, Comma>

Variants of enum

§

Struct

A syn::ItemStruct, minus common parts

Uses custom Fields, supporting field initializers.

Fields

§token: Struct

struct

§fields: Fields

Fields of struct

§

Type

A syn::ItemType, minus common parts

Fields

§token: Type

type

§eq_token: Eq

=

§ty: Box<Type>

Target type

§

Union

A syn::ItemUnion, minus common parts

Fields

§token: Union

union

§fields: FieldsNamed

Fields of union

Implementations§

Source§

impl ScopeItem

Source

pub fn token_span(&self) -> Span

Take span of enum/struct/type/union token

Trait Implementations§

Source§

impl Debug for ScopeItem

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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