pub enum Variant {
Varint,
SixtyFourBit,
LengthDelimited,
ThirtyTwoBit,
}Expand description
Represents the wire type variant of a field in a protocol buffer message.
The Variant enum provides a set of predefined wire types that can be used when creating
the header for a field. Each variant corresponds to a specific wire type value.
§Variants
Varint- Represents the varint wire type (value 0).SixtyFourBit- Represents the 64-bit wire type (value 1).LengthDelimited- Represents the length-delimited wire type (value 2).ThirtyTwoBit- Represents the 32-bit wire type (value 5).
§Conversions
The Variant enum implements the Into<u64> trait, allowing conversion from a Variant
to its corresponding wire type value as a u64.
§Examples
use rustwire::Variant;
let variant = Variant::LengthDelimited;
let wire_type_value: u64 = variant.into();
assert_eq!(wire_type_value, 2);In this example, the LengthDelimited variant is created and then converted into its
corresponding wire type value using the into() method. The resulting wire_type_value
is of type u64 and has a value of 2.
Variants§
Trait Implementations§
impl Eq for Variant
impl StructuralPartialEq for Variant
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Send for Variant
impl Sync for Variant
impl Unpin for Variant
impl UnwindSafe for Variant
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