Enum darling::ast::Data
[−]
[src]
pub enum Data<V, F> {
Enum(Vec<V>),
Struct(Fields<F>),
}A struct or enum body.
V is the type which receives any encountered variants, and F receives struct fields.
Variants
Enum(Vec<V>)Struct(Fields<F>)
Methods
impl<V, F> Data<V, F>[src]
fn empty_from(src: &Data) -> Data<V, F>[src]
Creates an empty body of the same shape as the passed-in body.
fn as_ref(&'a self) -> Data<&'a V, &'a F>[src]
Creates a new Data<&'a V, &'a F> instance from Data<V, F>.
fn map_enum_variants<T, U>(self, map: T) -> Data<U, F> where
T: FnMut(V) -> U, [src]
T: FnMut(V) -> U,
Applies a function V -> U on enum variants, if this is an enum.
fn map_struct_fields<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(F) -> U, [src]
T: FnMut(F) -> U,
Applies a function F -> U on struct fields, if this is a struct.
fn map_struct<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(Fields<F>) -> Fields<U>, [src]
T: FnMut(Fields<F>) -> Fields<U>,
Applies a function to the Fields if this is a struct.
fn take_struct(self) -> Option<Fields<F>>[src]
Consumes the Data, returning Fields<F> if it was a struct.
fn take_enum(self) -> Option<Vec<V>>[src]
Consumes the Data, returning Vec<V> if it was an enum.
fn is_enum(&self) -> bool[src]
Returns true if this instance is Data::Enum.
fn is_struct(&self) -> bool[src]
Returns true if this instance is Data::Struct.
impl<V, F> Data<V, F> where
F: FromField,
V: FromVariant, [src]
F: FromField,
V: FromVariant,
fn try_from(body: &Data) -> Result<Data<V, F>, Error>[src]
Attempt to convert from a syn::Data instance.
Trait Implementations
impl<V, F> Clone for Data<V, F> where
F: Clone,
V: Clone, [src]
F: Clone,
V: Clone,
impl<V, F> Eq for Data<V, F> where
F: Eq,
V: Eq, [src]
F: Eq,
V: Eq,
impl<V, F> PartialEq<Data<V, F>> for Data<V, F> where
F: PartialEq<F>,
V: PartialEq<V>, [src]
F: PartialEq<F>,
V: PartialEq<V>,
impl<V, F> Debug for Data<V, F> where
F: Debug,
V: Debug, [src]
F: Debug,
V: Debug,