pub struct PStructField {
pub name: PName,
pub ty: TokenStream,
pub offset: TokenStream,
pub attrs: PAttrs,
}Expand description
Parsed field
Fields§
§name: PNameThe field’s name (with rename rules applied)
ty: TokenStreamThe field’s type
offset: TokenStreamThe field’s offset (can be an expression, like offset_of!(self, field))
attrs: PAttrsThe field’s attributes
Implementations§
Source§impl PStructField
impl PStructField
Sourcepub fn from_struct_field(
f: &StructField,
rename_all_rule: Option<RenameRule>,
) -> PStructField
pub fn from_struct_field( f: &StructField, rename_all_rule: Option<RenameRule>, ) -> PStructField
Parse a named struct field (usual struct).
Sourcepub 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
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
impl Clone for PStructField
Source§fn clone(&self) -> PStructField
fn clone(&self) -> PStructField
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PStructField
impl RefUnwindSafe for PStructField
impl !Send for PStructField
impl !Sync for PStructField
impl Unpin for PStructField
impl UnwindSafe for PStructField
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