Enum darling_core::ast::Body
[−]
[src]
pub enum Body<V, F> { Enum(Vec<V>), Struct(VariantData<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(VariantData<F>)
Methods
impl<V, F> Body<V, F>
[src]
fn empty_from(src: &Body) -> Self
Creates an empty body of the same shape as the passed-in body.
fn as_ref<'a>(&'a self) -> Body<&'a V, &'a F>
Creates a new Body<&'a V, &'a F>
instance from Body<V, F>
.
fn map_enum_variants<T, U>(self, map: T) -> Body<U, F> where
T: FnMut(V) -> U,
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) -> Body<V, U> where
T: FnMut(F) -> U,
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) -> Body<V, U> where
T: FnMut(VariantData<F>) -> VariantData<U>,
T: FnMut(VariantData<F>) -> VariantData<U>,
Applies a function to the VariantData
if this is a struct.
fn take_struct(self) -> Option<VariantData<F>>
Consumes the Body
, returning VariantData<F>
if it was a struct.
fn take_enum(self) -> Option<Vec<V>>
Consumes the Body
, returning Vec<V>
if it was an enum.
fn is_enum(&self) -> bool
Returns true
if this instance is Body::Enum
.
fn is_struct(&self) -> bool
Returns true
if this instance is Body::Struct
.
impl<V: FromVariant, F: FromField> Body<V, F>
[src]
Trait Implementations
impl<V: Debug, F: Debug> Debug for Body<V, F>
[src]
impl<V: Clone, F: Clone> Clone for Body<V, F>
[src]
fn clone(&self) -> Body<V, F>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<V: PartialEq, F: PartialEq> PartialEq for Body<V, F>
[src]
fn eq(&self, __arg_0: &Body<V, F>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Body<V, F>) -> bool
This method tests for !=
.