pub enum Fields {
Named(FieldsNamed),
Unnamed(FieldsUnnamed),
Unit,
}
Expand description
Data stored within an enum variant or struct.
This type is available only if Syn is built with the "derive"
or "full"
feature.
§Syntax tree enum
This type is a syntax tree enum.
Variants§
Named(FieldsNamed)
Named fields of a struct or struct variant such as Point { x: f64, y: f64 }
.
Unnamed(FieldsUnnamed)
Unnamed fields of a tuple struct or tuple variant such as Some(T)
.
Unit
Unit struct or unit variant such as None
.
Implementations§
source§impl Fields
impl Fields
sourcepub fn iter(&self) -> Iter<'_, Field> ⓘ
pub fn iter(&self) -> Iter<'_, Field> ⓘ
Get an iterator over the borrowed Field
items in this object. This
iterator can be used to iterate over a named or unnamed struct or
variant’s fields uniformly.
Trait Implementations§
source§impl From<FieldsNamed> for Fields
impl From<FieldsNamed> for Fields
source§fn from(e: FieldsNamed) -> Fields
fn from(e: FieldsNamed) -> Fields
Converts to this type from the input type.
source§impl From<FieldsUnnamed> for Fields
impl From<FieldsUnnamed> for Fields
source§fn from(e: FieldsUnnamed) -> Fields
fn from(e: FieldsUnnamed) -> Fields
Converts to this type from the input type.
source§impl<'a> IntoIterator for &'a Fields
impl<'a> IntoIterator for &'a Fields
source§impl<'a> IntoIterator for &'a mut Fields
impl<'a> IntoIterator for &'a mut Fields
source§impl IntoIterator for Fields
impl IntoIterator for Fields
source§impl ToTokens for Fields
impl ToTokens for Fields
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Eq for Fields
Auto Trait Implementations§
impl Freeze for Fields
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.