FieldValue

Enum FieldValue 

Source
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

Source

pub fn from_varint(varint: Varint) -> Self

Create a field value from a Varint

Source

pub fn from_uint64(value: u64) -> Self

Create a field value from a UInt64 protobuf type

Source

pub fn from_uint32(value: u32) -> Self

Create a field value from a UInt32 protobuf type

Source

pub fn from_sint64(value: i64) -> Self

Create a field value from a SInt64 protobuf type (ZigZag encoded)

Source

pub fn from_sint32(value: i32) -> Self

Create a field value from a SInt32 protobuf type (ZigZag encoded)

Source

pub fn from_int64(value: i64) -> Self

Create a field value from an Int64 protobuf type (non-ZigZag)

Source

pub fn from_int32(value: i32) -> Self

Create a field value from an Int32 protobuf type (non-ZigZag)

Source

pub fn from_bool(value: bool) -> Self

Create a field value from a Bool protobuf type

Source

pub fn from_fixed32(value: u32) -> Self

Create a field value from a Fixed32 protobuf type

Source

pub fn from_sfixed32(value: i32) -> Self

Create a field value from a SFixed32 protobuf type

Source

pub fn from_float(value: f32) -> Self

Create a field value from a Float protobuf type

Source

pub fn from_fixed64(value: u64) -> Self

Create a field value from a Fixed64 protobuf type

Source

pub fn from_sfixed64(value: i64) -> Self

Create a field value from a SFixed64 protobuf type

Source

pub fn from_double(value: f64) -> Self

Create a field value from a Double protobuf type

Source

pub fn from_bytes(data: Vec<u8>) -> Self

Create a field value from raw bytes (Bytes protobuf type)

Source

pub fn from_string(s: String) -> Self

Create a field value from a String protobuf type

Source

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

Source§

fn clone(&self) -> FieldValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FieldValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FieldValue

Source§

fn eq(&self, other: &FieldValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FieldValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.