pub enum EnumVariant {
Unit(String),
Newtype(String, CodecExpr),
Tuple(String, Vec<CodecExpr>),
Struct(String, Vec<(String, CodecExpr)>),
}Expand description
An enum variant for CodeGenerator::add_enum.
Variants§
Unit(String)
A unit variant: Name - emitted as Name: null.
Newtype(String, CodecExpr)
A newtype (1-tuple) variant: Name(T) - emitted as a bare codec.
Tuple(String, Vec<CodecExpr>)
An n-tuple variant (n >= 2): Name(T0, T1) - emitted as an array of codecs ([t0, t1]), decoded as an array value.
The fields stay flattened in the enum layout (this is NOT a nested r.tuple block).
Struct(String, Vec<(String, CodecExpr)>)
A struct variant: Name { a: T } — emitted as a record of codecs.
Implementations§
Trait Implementations§
Source§impl Clone for EnumVariant
impl Clone for EnumVariant
Source§fn clone(&self) -> EnumVariant
fn clone(&self) -> EnumVariant
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EnumVariant
impl RefUnwindSafe for EnumVariant
impl Send for EnumVariant
impl Sync for EnumVariant
impl Unpin for EnumVariant
impl UnsafeUnpin for EnumVariant
impl UnwindSafe for EnumVariant
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