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