Trait synthez::DataExt [−][src]
pub trait DataExt: Sealed { fn named_fields(self) -> Result<Punctuated<Field, Comma>, Error>; fn named_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>; fn unnamed_fields(self) -> Result<Punctuated<Field, Comma>, Error>; fn unnamed_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>; }
Expand description
Extension of a [syn::Data
].
Required methods
fn named_fields(self) -> Result<Punctuated<Field, Comma>, Error>
fn named_fields(self) -> Result<Punctuated<Field, Comma>, Error>
Parses [syn::Fields::Named
] from this consumed [syn::Data::Struct
]
and returns owning iterator over them.
Errors
- If this [
syn::Data
] is not a [syn::Data::Struct
]. - If this [
syn::Data::Struct
] doesn’t consist of [syn::Fields::Named
].
fn named_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>
fn named_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>
Parses [syn::Fields::Named
] from this borrowed [syn::Data::Struct
]
and returns referencing iterator over them.
Errors
- If this [
syn::Data
] is not a [syn::Data::Struct
]. - If this [
syn::Data::Struct
] doesn’t consist of [syn::Fields::Named
].
fn unnamed_fields(self) -> Result<Punctuated<Field, Comma>, Error>
fn unnamed_fields(self) -> Result<Punctuated<Field, Comma>, Error>
Parses [syn::Fields::Unnamed
] from this consumed [syn::Data::Struct
]
and returns owning iterator over them.
Errors
- If this [
syn::Data
] is not a [syn::Data::Struct
]. - If this [
syn::Data::Struct
] doesn’t consist of [syn::Fields::Unnamed
].
fn unnamed_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>
fn unnamed_fields_ref(&self) -> Result<&Punctuated<Field, Comma>, Error>
Parses [syn::Fields::Unnamed
] from this borrowed [syn::Data::Struct
]
and returns referencing iterator over them.
Errors
- If this [
syn::Data
] is not a [syn::Data::Struct
]. - If this [
syn::Data::Struct
] doesn’t consist of [syn::Fields::Unnamed
].