pub enum FieldValue {
Varint(Varint),
I32([u8; 4]),
I64([u8; 8]),
Len(Vec<u8>),
}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.
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(Vec<u8>)
Length-delimited values (String, Bytes, embedded messages, packed repeated fields)
Implementations§
Source§impl FieldValue
impl FieldValue
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 from_bytes(data: Vec<u8>) -> Self
pub fn from_bytes(data: Vec<u8>) -> Self
Create a field value from raw bytes (Bytes protobuf type)
Sourcepub fn from_string(s: String) -> Self
pub fn from_string(s: String) -> Self
Create a field value from a String 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 Clone for FieldValue
impl Clone for FieldValue
Source§fn clone(&self) -> FieldValue
fn clone(&self) -> FieldValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more