pub enum VariantsShape {
Single {
index: VariantIdx,
},
Multiple {
tag: Scalar,
tag_encoding: TagEncoding,
tag_field: usize,
variants: Vec<LayoutShape>,
},
}
Variants§
Single
Single enum variants, structs/tuples, unions, and all non-ADTs.
Fields
§
index: VariantIdx
Multiple
Enum-likes with more than one inhabited variant: each variant comes with a discriminant (usually the same as the variant index but the user can assign explicit discriminant values). That discriminant is encoded as a tag on the machine. The layout of each variant is a struct, and they all have space reserved for the tag. For enums, the tag is the sole field of the layout.
Trait Implementations§
source§impl Clone for VariantsShape
impl Clone for VariantsShape
source§fn clone(&self) -> VariantsShape
fn clone(&self) -> VariantsShape
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for VariantsShape
impl Debug for VariantsShape
source§impl Hash for VariantsShape
impl Hash for VariantsShape
source§impl PartialEq for VariantsShape
impl PartialEq for VariantsShape
source§impl Serialize for VariantsShape
impl Serialize for VariantsShape
impl Eq for VariantsShape
impl StructuralPartialEq for VariantsShape
Auto Trait Implementations§
impl Freeze for VariantsShape
impl RefUnwindSafe for VariantsShape
impl Send for VariantsShape
impl Sync for VariantsShape
impl Unpin for VariantsShape
impl UnwindSafe for VariantsShape
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 128 bytes
Size for each variant:
Single
: 8 bytesMultiple
: 128 bytes