PStructField

Struct PStructField 

Source
pub struct PStructField {
    pub name: PName,
    pub ty: TokenStream,
    pub offset: TokenStream,
    pub attrs: PAttrs,
}
Expand description

Parsed field

Fields§

§name: PName

The field’s name (with rename rules applied)

§ty: TokenStream

The field’s type

§offset: TokenStream

The field’s offset (can be an expression, like offset_of!(self, field))

§attrs: PAttrs

The field’s attributes

Implementations§

Source§

impl PStructField

Source

pub fn from_struct_field( f: &StructField, rename_all_rule: Option<RenameRule>, ) -> PStructField

Parse a named struct field (usual struct).

Source

pub fn from_enum_field( attrs: &[Attribute], idx: usize, typ: &DelimitedVec<Cons<Except<Operator<unsynn::::operator::names::Comma::{constant#0}, unsynn::::operator::names::Comma::{constant#1}, unsynn::::operator::names::Comma::{constant#2}, unsynn::::operator::names::Comma::{constant#3}>>, AngleTokenTree>, Nothing, Optional, 1, unsynn::::container::Many::{constant#1}>, rename_all_rule: Option<RenameRule>, ) -> PStructField

Parse a tuple (unnamed) field for tuple structs or enum tuple variants. The index is converted to an identifier like _0, _1, etc.

Trait Implementations§

Source§

impl Clone for PStructField

Source§

fn clone(&self) -> PStructField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.