Struct marker_api::ast::StructItem

source ·
#[repr(C)]
pub struct StructItem<'ast> { /* private fields */ }
Expand description

A struct item like:

pub struct Foo;
pub struct Bar(u32, u32);
pub struct Baz {
    field_1: u32,
    field_2: u32,
}

Implementations§

source§

impl<'ast> StructItem<'ast>

source

pub fn generics(&self) -> &GenericParams<'ast>

source

pub fn is_unit_struct(&self) -> bool

Returns true if this is a unit struct like:

struct Name1;
struct Name2 {};
source

pub fn is_tuple_struct(&self) -> bool

Returns true if this is a tuple struct like:

struct Name(u32, u64);
source

pub fn is_field_struct(&self) -> bool

Returns true if this is a field struct like:

struct Name {
    field: u32,
};
source

pub fn fields(&self) -> &[ItemField<'ast>]

Trait Implementations§

source§

impl<'ast> Debug for StructItem<'ast>

source§

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

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

impl<'ast> From<&'ast StructItem<'ast>> for ItemKind<'ast>

source§

fn from(value: &'ast StructItem<'ast>) -> Self

Converts to this type from the input type.
source§

impl<'ast> HasNodeId for StructItem<'ast>

source§

fn node_id(&self) -> NodeId

Returns the NodeId of the identifiable node
source§

impl<'ast> HasSpan<'ast> for StructItem<'ast>

source§

fn span(&self) -> &Span<'ast>

This returns the Span of the implementing AST node.
source§

impl<'ast> ItemData<'ast> for StructItem<'ast>

source§

fn id(&self) -> ItemId

Returns the ItemId of this item. This is a unique identifier used for comparison and to request items from the MarkerContext.
source§

fn visibility(&self) -> &Visibility<'ast>

The Visibility of this item.
source§

fn ident(&self) -> Option<&Ident<'ast>>

This function can return None if the item was generated and has no real name
source§

fn as_item(&'ast self) -> ItemKind<'ast>

Returns this item wrapped in it’s ExprKind variant. Read more
source§

fn attrs(&self)

The attributes attached to this item. Read more

Auto Trait Implementations§

§

impl<'ast> RefUnwindSafe for StructItem<'ast>

§

impl<'ast> !Send for StructItem<'ast>

§

impl<'ast> !Sync for StructItem<'ast>

§

impl<'ast> Unpin for StructItem<'ast>

§

impl<'ast> UnwindSafe for StructItem<'ast>

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

§

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

§

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<'ast, N> EmissionNode<'ast> for N
where N: Debug + HasSpan<'ast> + HasNodeId,