Enum darling::ast::Data [−][src]
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]
impl<V, F> Data<V, F>
pub fn empty_from(src: &Data) -> Data<V, F>
[src]
pub fn empty_from(src: &Data) -> Data<V, F>
Creates an empty body of the same shape as the passed-in body.
pub fn as_ref(&'a self) -> Data<&'a V, &'a F>
[src]
pub fn as_ref(&'a self) -> Data<&'a V, &'a F>
Creates a new Data<&'a V, &'a F>
instance from Data<V, F>
.
pub fn map_enum_variants<T, U>(self, map: T) -> Data<U, F> where
T: FnMut(V) -> U,
[src]
pub fn map_enum_variants<T, U>(self, map: T) -> Data<U, F> where
T: FnMut(V) -> U,
Applies a function V -> U
on enum variants, if this is an enum.
pub fn map_struct_fields<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(F) -> U,
[src]
pub fn map_struct_fields<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(F) -> U,
Applies a function F -> U
on struct fields, if this is a struct.
pub fn map_struct<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(Fields<F>) -> Fields<U>,
[src]
pub fn map_struct<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(Fields<F>) -> Fields<U>,
Applies a function to the Fields
if this is a struct.
pub fn take_struct(self) -> Option<Fields<F>>
[src]
pub fn take_struct(self) -> Option<Fields<F>>
Consumes the Data
, returning Fields<F>
if it was a struct.
pub fn take_enum(self) -> Option<Vec<V>>
[src]
pub fn take_enum(self) -> Option<Vec<V>>
Consumes the Data
, returning Vec<V>
if it was an enum.
pub fn is_enum(&self) -> bool
[src]
pub fn is_enum(&self) -> bool
Returns true
if this instance is Data::Enum
.
pub fn is_struct(&self) -> bool
[src]
pub fn is_struct(&self) -> bool
Returns true
if this instance is Data::Struct
.
impl<V, F> Data<V, F> where
F: FromField,
V: FromVariant,
[src]
impl<V, F> Data<V, F> where
F: FromField,
V: FromVariant,
pub fn try_from(body: &Data) -> Result<Data<V, F>, Error>
[src]
pub fn try_from(body: &Data) -> Result<Data<V, F>, Error>
Attempt to convert from a syn::Data
instance.
Trait Implementations
impl<V, F> UsesLifetimes for Data<V, F> where
F: UsesLifetimes,
V: UsesLifetimes,
[src]
impl<V, F> UsesLifetimes for Data<V, F> where
F: UsesLifetimes,
V: UsesLifetimes,
fn uses_lifetimes(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
[src]
fn uses_lifetimes(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
Returns the subset of the queried lifetimes that are used by the implementing syntax element. Read more
fn uses_lifetimes_cloned(
&self,
options: &Options,
lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
[src]
fn uses_lifetimes_cloned(
&self,
options: &Options,
lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
Find all used lifetimes, then clone them and return that set.
impl<V, F> Clone for Data<V, F> where
F: Clone,
V: Clone,
[src]
impl<V, F> Clone for Data<V, F> where
F: Clone,
V: Clone,
fn clone(&self) -> Data<V, F>
[src]
fn clone(&self) -> Data<V, F>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<V, F> Debug for Data<V, F> where
F: Debug,
V: Debug,
[src]
impl<V, F> Debug for Data<V, F> where
F: Debug,
V: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<V, F> UsesTypeParams for Data<V, F> where
F: UsesTypeParams,
V: UsesTypeParams,
[src]
impl<V, F> UsesTypeParams for Data<V, F> where
F: UsesTypeParams,
V: UsesTypeParams,
fn uses_type_params(
&self,
options: &Options,
type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>
[src]
fn uses_type_params(
&self,
options: &Options,
type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>
Returns the subset of the queried type parameters that are used by the implementing syntax element. Read more
fn uses_type_params_cloned(
&self,
options: &Options,
type_set: &HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<Ident, BuildHasherDefault<FnvHasher>>
[src]
fn uses_type_params_cloned(
&self,
options: &Options,
type_set: &HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<Ident, BuildHasherDefault<FnvHasher>>
Find all type params using uses_type_params
, then clone the found values and return the set.
impl<V, F> Eq for Data<V, F> where
F: Eq,
V: Eq,
[src]
impl<V, F> Eq for Data<V, F> where
F: Eq,
V: Eq,
impl<V, F> PartialEq<Data<V, F>> for Data<V, F> where
F: PartialEq<F>,
V: PartialEq<V>,
[src]
impl<V, F> PartialEq<Data<V, F>> for Data<V, F> where
F: PartialEq<F>,
V: PartialEq<V>,