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.
Creates an empty body of the same shape as the passed-in body.
Creates a new Data<&'a V, &'a F>
instance from Data<V, F>
.
Applies a function V -> U
on enum variants, if this is an enum.
Applies a function F -> U
on struct fields, if this is a struct.
Applies a function to the Fields
if this is a struct.
Consumes the Data
, returning Fields<F>
if it was a struct.
Consumes the Data
, returning Vec<V>
if it was an enum.
Returns true
if this instance is Data::Enum
.
Returns true
if this instance is Data::Struct
.
Attempt to convert from a syn::Data
instance.
Returns the subset of the queried lifetimes that are used by the implementing syntax element. Read more
Find all used lifetimes, then clone them and return that set.
Returns the subset of the queried type parameters that are used by the implementing syntax element. Read more
Find all type params using uses_type_params
, then clone the found values and return the set.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more