[][src]Enum darling_core::ast::Data

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]

pub fn empty_from(src: &Data) -> Self
[src]

Creates an empty body of the same shape as the passed-in body.

pub fn as_ref<'a>(&'a self) -> Data<&'a V, &'a F>
[src]

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]

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]

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]

Applies a function to the Fields if this is a struct.

pub fn take_struct(self) -> Option<Fields<F>>
[src]

Consumes the Data, returning Fields<F> if it was a struct.

pub fn take_enum(self) -> Option<Vec<V>>
[src]

Consumes the Data, returning Vec<V> if it was an enum.

pub fn is_enum(&self) -> bool
[src]

Returns true if this instance is Data::Enum.

pub fn is_struct(&self) -> bool
[src]

Returns true if this instance is Data::Struct.

impl<V: FromVariant, F: FromField> Data<V, F>
[src]

pub fn try_from(body: &Data) -> Result<Self>
[src]

Attempt to convert from a syn::Data instance.

Trait Implementations

impl<V: UsesLifetimes, F: UsesLifetimes> UsesLifetimes for Data<V, F>
[src]

fn uses_lifetimes_cloned(
    &self,
    options: &Options,
    lifetimes: &LifetimeSet
) -> LifetimeSet
[src]

Find all used lifetimes, then clone them and return that set.

impl<V: UsesTypeParams, F: UsesTypeParams> UsesTypeParams for Data<V, F>
[src]

fn uses_type_params_cloned(
    &self,
    options: &Options,
    type_set: &IdentSet
) -> IdentSet
[src]

Find all type params using uses_type_params, then clone the found values and return the set.

impl<V: PartialEq, F: PartialEq> PartialEq<Data<V, F>> for Data<V, F>
[src]

impl<V: Eq, F: Eq> Eq for Data<V, F>
[src]

impl<V: Clone, F: Clone> Clone for Data<V, F>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<V: Debug, F: Debug> Debug for Data<V, F>
[src]

Auto Trait Implementations

impl<V, F> Send for Data<V, F> where
    F: Send,
    V: Send

impl<V, F> Sync for Data<V, F> where
    F: Sync,
    V: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]