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>
impl<'ast> StructItem<'ast>
pub fn generics(&self) -> &GenericParams<'ast>
sourcepub fn is_unit_struct(&self) -> bool
pub fn is_unit_struct(&self) -> bool
Returns true
if this is a unit struct like:
struct Name1;
struct Name2 {};
sourcepub fn is_tuple_struct(&self) -> bool
pub fn is_tuple_struct(&self) -> bool
Returns true
if this is a tuple struct like:
struct Name(u32, u64);
sourcepub fn is_field_struct(&self) -> bool
pub fn is_field_struct(&self) -> bool
Returns true
if this is a field struct like:
struct Name {
field: u32,
};
pub fn fields(&self) -> &[ItemField<'ast>]
Trait Implementations§
source§impl<'ast> Debug for StructItem<'ast>
impl<'ast> Debug for StructItem<'ast>
source§impl<'ast> From<&'ast StructItem<'ast>> for ItemKind<'ast>
impl<'ast> From<&'ast StructItem<'ast>> for ItemKind<'ast>
source§fn from(value: &'ast StructItem<'ast>) -> Self
fn from(value: &'ast StructItem<'ast>) -> Self
Converts to this type from the input type.
source§impl<'ast> HasNodeId for StructItem<'ast>
impl<'ast> HasNodeId for StructItem<'ast>
source§impl<'ast> HasSpan<'ast> for StructItem<'ast>
impl<'ast> HasSpan<'ast> for StructItem<'ast>
source§impl<'ast> ItemData<'ast> for StructItem<'ast>
impl<'ast> ItemData<'ast> for StructItem<'ast>
source§fn id(&self) -> ItemId
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>
fn visibility(&self) -> &Visibility<'ast>
The
Visibility
of this item.source§fn ident(&self) -> Option<&Ident<'ast>>
fn ident(&self) -> Option<&Ident<'ast>>
This function can return
None
if the item was generated and has no real nameAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more