pub struct FieldReader<'a> { /* private fields */ }Expand description
Field-based reader for structured data decoding
Implementations§
Source§impl<'a> FieldReader<'a>
impl<'a> FieldReader<'a>
Sourcepub fn new(data: &'a [u8]) -> Result<Self, DecodingError>
pub fn new(data: &'a [u8]) -> Result<Self, DecodingError>
Create a new field reader
Sourcepub fn get_field(&self, field: u32) -> Option<&[u8]>
pub fn get_field(&self, field: u32) -> Option<&[u8]>
Get field data by number (used by envelope decoding)
Sourcepub fn field_numbers(&self) -> Vec<u32>
pub fn field_numbers(&self) -> Vec<u32>
Get all field numbers (this is problematic without schema info)
Sourcepub fn read_uvarint_field(
&self,
field: u32,
) -> Result<Option<u64>, DecodingError>
pub fn read_uvarint_field( &self, field: u32, ) -> Result<Option<u64>, DecodingError>
Read uvarint from field (no length prefix)
Sourcepub fn read_varint_field(
&self,
field: u32,
) -> Result<Option<i64>, DecodingError>
pub fn read_varint_field( &self, field: u32, ) -> Result<Option<i64>, DecodingError>
Read varint from field (no length prefix)
Sourcepub fn read_big_number_field(
&self,
field: u32,
) -> Result<Option<BigUint>, DecodingError>
pub fn read_big_number_field( &self, field: u32, ) -> Result<Option<BigUint>, DecodingError>
Read big number from field
Sourcepub fn read_bool_field(&self, field: u32) -> Result<Option<bool>, DecodingError>
pub fn read_bool_field(&self, field: u32) -> Result<Option<bool>, DecodingError>
Read boolean from field
Sourcepub fn read_bytes_field(
&self,
field: u32,
) -> Result<Option<Vec<u8>>, DecodingError>
pub fn read_bytes_field( &self, field: u32, ) -> Result<Option<Vec<u8>>, DecodingError>
Read bytes from field (with length prefix)
Sourcepub fn read_string_field(
&self,
field: u32,
) -> Result<Option<String>, DecodingError>
pub fn read_string_field( &self, field: u32, ) -> Result<Option<String>, DecodingError>
Read string from field (with length prefix)
Sourcepub fn read_hash_field(
&self,
field: u32,
) -> Result<Option<[u8; 32]>, DecodingError>
pub fn read_hash_field( &self, field: u32, ) -> Result<Option<[u8; 32]>, DecodingError>
Read hash from field
Trait Implementations§
Source§impl<'a> Clone for FieldReader<'a>
impl<'a> Clone for FieldReader<'a>
Source§fn clone(&self) -> FieldReader<'a>
fn clone(&self) -> FieldReader<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for FieldReader<'a>
impl<'a> RefUnwindSafe for FieldReader<'a>
impl<'a> Send for FieldReader<'a>
impl<'a> Sync for FieldReader<'a>
impl<'a> Unpin for FieldReader<'a>
impl<'a> UnsafeUnpin for FieldReader<'a>
impl<'a> UnwindSafe for FieldReader<'a>
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