Enum syn_helpers::Fields
source · pub enum Fields {
Named(Vec<NamedField>, Vec<Attribute>),
Unnamed(Vec<UnnamedField>, Vec<Attribute>),
Unit(Vec<Attribute>),
}
Expand description
Represents the fields in a structure. This could be the fields on a struct or the fields in the variant of a enum
Variants§
Named(Vec<NamedField>, Vec<Attribute>)
*name* { X: String }
Unnamed(Vec<UnnamedField>, Vec<Attribute>)
*name*(String)
Unit(Vec<Attribute>)
No fields *name*
Implementations§
source§impl Fields
impl Fields
pub fn get_field_attributes(&self) -> &[Attribute]
pub fn fields_iterator( &self ) -> impl ExactSizeIterator<Item = NamedOrUnnamedField<'_>>
pub fn fields_iterator_mut( &mut self ) -> impl ExactSizeIterator<Item = NamedOrUnnamedFieldMut<'_>>
pub fn to_pattern(&self, path: Path, type_of_self: TypeOfSelf) -> TokenStream
pub fn to_pattern_with_config( &self, path: Path, type_of_self: TypeOfSelf, name_postfix: &'static str ) -> TokenStream
pub fn to_constructor<'b>( &'b self, generator: impl Fn(NamedOrUnnamedField<'b>) -> Result<Expr, Box<dyn Error>>, constructor: Path ) -> Result<Expr, Box<dyn Error>>
sourcepub fn get_field_by_member(
&self,
member: Member
) -> Option<NamedOrUnnamedField<'_>>
pub fn get_field_by_member( &self, member: Member ) -> Option<NamedOrUnnamedField<'_>>
Will just return None
if member is not of matching form. Also will return None
if cannot find the field
sourcepub fn get_field_by_member_mut(
&mut self,
member: Member
) -> Option<NamedOrUnnamedFieldMut<'_>>
pub fn get_field_by_member_mut( &mut self, member: Member ) -> Option<NamedOrUnnamedFieldMut<'_>>
Will just return None
if member is not of matching form. Also will return None
if cannot find the field
Auto Trait Implementations§
impl RefUnwindSafe for Fields
impl !Send for Fields
impl !Sync for Fields
impl Unpin for Fields
impl UnwindSafe for Fields
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