Enum darling::ast::Data [−][src]
Expand description
A struct or enum body.
V
is the type which receives any encountered variants, and F
receives struct fields.
Variants
Struct(Fields<F>)
Implementations
impl<V, F> Data<V, F>
[src]
impl<V, F> Data<V, F>
[src]pub fn empty_from(src: &Data) -> Data<V, F>
[src]
pub fn empty_from(src: &Data) -> Data<V, F>
[src]Creates an empty body of the same shape as the passed-in body.
Panics
This function will panic if passed syn::Data::Union
.
pub fn try_empty_from(src: &Data) -> Result<Data<V, F>, Error>
[src]
pub fn try_empty_from(src: &Data) -> Result<Data<V, F>, Error>
[src]Creates an empty body of the same shape as the passed-in body.
darling
does not support unions; calling this function with a union body will return an error.
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,
[src]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,
[src]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>,
[src]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>>
[src]Consumes the Data
, returning Fields<F>
if it was a struct.
impl<V, F> Data<V, F> where
F: FromField,
V: FromVariant,
[src]
impl<V, F> Data<V, F> where
F: FromField,
V: FromVariant,
[src]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,
[src]pub fn uses_lifetimes(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
[src]
pub fn uses_lifetimes(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
[src]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>>
[src]Find all used lifetimes, then clone them and return that set.
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,
[src]pub fn uses_type_params(
&self,
options: &Options,
type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>
[src]
pub fn uses_type_params(
&self,
options: &Options,
type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>
[src]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>>
[src]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]
F: Eq,
V: Eq,
impl<V, F> StructuralEq for Data<V, F>
[src]
impl<V, F> StructuralPartialEq for Data<V, F>
[src]
Auto Trait Implementations
impl<V, F> RefUnwindSafe for Data<V, F> where
F: RefUnwindSafe,
V: RefUnwindSafe,
F: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, F> !Send for Data<V, F>
impl<V, F> !Sync for Data<V, F>
impl<V, F> Unpin for Data<V, F> where
F: Unpin,
V: Unpin,
F: Unpin,
V: Unpin,
impl<V, F> UnwindSafe for Data<V, F> where
F: UnwindSafe,
V: UnwindSafe,
F: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more