pub struct Field<L> {
pub field_number: FieldNumber,
pub value: FieldValue<L>,
}Expand description
A raw field read from the wire
Contains the field number and the raw field value. The caller must interpret the value based on the message schema.
L is the type for length-delimited values (FieldValue::Len).
For owned data (from std::io::Read): use Vec<u8>
For borrowed data (from slices): use &'a [u8]
Fields§
§field_number: FieldNumber§value: FieldValue<L>Implementations§
Source§impl<L> Field<L>
impl<L> Field<L>
Sourcepub fn new(field_number: FieldNumber, value: FieldValue<L>) -> Self
pub fn new(field_number: FieldNumber, value: FieldValue<L>) -> Self
Create a new field with the given field number and value
Sourcepub fn encoded_size(&self) -> usize
pub fn encoded_size(&self) -> usize
Calculate the total encoded size of this field in bytes (tag + value)
Trait Implementations§
impl<L> StructuralPartialEq for Field<L>
Auto Trait Implementations§
impl<L> Freeze for Field<L>where
L: Freeze,
impl<L> RefUnwindSafe for Field<L>where
L: RefUnwindSafe,
impl<L> Send for Field<L>where
L: Send,
impl<L> Sync for Field<L>where
L: Sync,
impl<L> Unpin for Field<L>where
L: Unpin,
impl<L> UnwindSafe for Field<L>where
L: UnwindSafe,
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