pub enum VariantKind {
Unit,
Newtype,
Tuple,
Struct,
}Expand description
The shape of an enum variant’s payload, used by the wrapper to decide how to encode/decode the value carried under the variant tag.
Unit and Newtype both have an empty payload Product — the
distinction lives in this discriminator. A unit variant carries no value
at all (the wire emits the variant tag with no payload), while a newtype
variant passes the inner value through directly under the variant tag
(zero-cost wrapper, no field-level tag/key allocated for the inner value).
Tuple and Struct variants both carry their fields in the variant’s
payload Product, but differ in addressing on the wire: tuple variants
use positional names (“0”, “1”, …) and struct variants use field idents.
Tuple variants with a single explicitly tagged field still count as
Tuple, not Newtype — the explicit #[tag(N)] is what asks for a
field-level tag wrapping.
Variants§
Trait Implementations§
Source§impl Clone for VariantKind
impl Clone for VariantKind
Source§fn clone(&self) -> VariantKind
fn clone(&self) -> VariantKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more