pub enum FieldValue<L> {
Varint(Varint),
I32([u8; 4]),
I64([u8; 8]),
Len(L),
}Expand description
A raw field value read from the wire
This represents the raw bytes of a field value without semantic interpretation. The caller is responsible for converting these raw values to the appropriate types based on the field’s schema definition.
L is the type for length-delimited values (Len variant).
- For owned data (from
std::io::Read): useVec<u8> - For borrowed data (from slices): use
&'a [u8]
Variants§
Varint(Varint)
Variable-width integers (Int32, Int64, UInt32, UInt64, SInt32, SInt64, Bool, Enum)
I32([u8; 4])
32-bit fixed-width values (Fixed32, SFixed32, Float)
I64([u8; 8])
64-bit fixed-width values (Fixed64, SFixed64, Double)
Len(L)
Length-delimited values (String, Bytes, embedded messages, packed repeated fields)
Implementations§
Source§impl<L> FieldValue<L>
impl<L> FieldValue<L>
Sourcepub fn from_varint(varint: Varint) -> Self
pub fn from_varint(varint: Varint) -> Self
Create a field value from a Varint
Sourcepub fn from_uint64(value: u64) -> Self
pub fn from_uint64(value: u64) -> Self
Create a field value from a UInt64 protobuf type
Sourcepub fn from_uint32(value: u32) -> Self
pub fn from_uint32(value: u32) -> Self
Create a field value from a UInt32 protobuf type
Sourcepub fn from_sint64(value: i64) -> Self
pub fn from_sint64(value: i64) -> Self
Create a field value from a SInt64 protobuf type (ZigZag encoded)
Sourcepub fn from_sint32(value: i32) -> Self
pub fn from_sint32(value: i32) -> Self
Create a field value from a SInt32 protobuf type (ZigZag encoded)
Sourcepub fn from_int64(value: i64) -> Self
pub fn from_int64(value: i64) -> Self
Create a field value from an Int64 protobuf type (non-ZigZag)
Sourcepub fn from_int32(value: i32) -> Self
pub fn from_int32(value: i32) -> Self
Create a field value from an Int32 protobuf type (non-ZigZag)
Sourcepub fn from_fixed32(value: u32) -> Self
pub fn from_fixed32(value: u32) -> Self
Create a field value from a Fixed32 protobuf type
Sourcepub fn from_sfixed32(value: i32) -> Self
pub fn from_sfixed32(value: i32) -> Self
Create a field value from a SFixed32 protobuf type
Sourcepub fn from_float(value: f32) -> Self
pub fn from_float(value: f32) -> Self
Create a field value from a Float protobuf type
Sourcepub fn from_fixed64(value: u64) -> Self
pub fn from_fixed64(value: u64) -> Self
Create a field value from a Fixed64 protobuf type
Sourcepub fn from_sfixed64(value: i64) -> Self
pub fn from_sfixed64(value: i64) -> Self
Create a field value from a SFixed64 protobuf type
Sourcepub fn from_double(value: f64) -> Self
pub fn from_double(value: f64) -> Self
Create a field value from a Double protobuf type
Sourcepub fn encoded_size(&self) -> usize
pub fn encoded_size(&self) -> usize
Calculate the encoded size of this field value in bytes (excluding the tag)
For Len values, this includes the length varint plus the data bytes.
Trait Implementations§
Source§impl<L: Clone> Clone for FieldValue<L>
impl<L: Clone> Clone for FieldValue<L>
Source§fn clone(&self) -> FieldValue<L>
fn clone(&self) -> FieldValue<L>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more