Expand description
A struct or enum body.
V
is the type which receives any encountered variants, and F
receives struct fields.
Variants
Enum(Vec<V, Global>)
Struct(Fields<F>)
Implementations
sourceimpl<V, F> Data<V, F>
impl<V, F> Data<V, F>
sourcepub fn empty_from(src: &Data) -> Data<V, F>
pub fn empty_from(src: &Data) -> Data<V, F>
Creates an empty body of the same shape as the passed-in body.
sourcepub fn as_ref(&'a self) -> Data<&'a V, &'a F>
pub fn as_ref(&'a self) -> Data<&'a V, &'a F>
Creates a new Data<&'a V, &'a F>
instance from Data<V, F>
.
sourcepub fn map_enum_variants<T, U>(self, map: T) -> Data<U, F> where
T: FnMut(V) -> U,
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.
sourcepub fn map_struct_fields<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(F) -> U,
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.
sourcepub fn map_struct<T, U>(self, map: T) -> Data<V, U> where
T: FnMut(Fields<F>) -> Fields<U>,
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.
sourcepub fn take_struct(self) -> Option<Fields<F>>
pub fn take_struct(self) -> Option<Fields<F>>
Consumes the Data
, returning Fields<F>
if it was a struct.
Trait Implementations
sourceimpl<V, F> UsesLifetimes for Data<V, F> where
V: UsesLifetimes,
F: UsesLifetimes,
impl<V, F> UsesLifetimes for Data<V, F> where
V: UsesLifetimes,
F: UsesLifetimes,
sourcefn uses_lifetimes(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
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
sourcefn uses_lifetimes_cloned(
&self,
options: &Options,
lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
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.
sourceimpl<V, F> UsesTypeParams for Data<V, F> where
V: UsesTypeParams,
F: UsesTypeParams,
impl<V, F> UsesTypeParams for Data<V, F> where
V: UsesTypeParams,
F: UsesTypeParams,
sourcefn uses_type_params(
&self,
options: &Options,
type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>
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
sourcefn uses_type_params_cloned(
&self,
options: &Options,
type_set: &HashSet<Ident, BuildHasherDefault<FnvHasher>>
) -> HashSet<Ident, BuildHasherDefault<FnvHasher>>
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
V: Eq,
F: Eq,
impl<V, F> StructuralEq for Data<V, F>
impl<V, F> StructuralPartialEq for Data<V, F>
Auto Trait Implementations
impl<V, F> RefUnwindSafe for Data<V, F> where
F: RefUnwindSafe,
V: RefUnwindSafe,
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,
impl<V, F> Unpin for Data<V, F> where
F: Unpin,
V: Unpin,
impl<V, F> UnwindSafe for Data<V, F> where
F: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more