pub struct Decoder<'a> { /* private fields */ }Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
pub fn new(input: &'a [u8]) -> Self
Sourcepub fn with_limits(input: &'a [u8], limits: DecodeLimits) -> Self
pub fn with_limits(input: &'a [u8], limits: DecodeLimits) -> Self
Creates a decoder with explicit resource limits.
Sourcepub const fn limits(&self) -> DecodeLimits
pub const fn limits(&self) -> DecodeLimits
Returns the resource limits inherited by nested decoders.
Sourcepub fn ensure_collection_length(
&self,
kind: &'static str,
length: usize,
) -> Result<()>
pub fn ensure_collection_length( &self, kind: &'static str, length: usize, ) -> Result<()>
Rejects a collection length before allocating storage for it.
pub fn remaining(&self) -> usize
pub fn position(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn read_i8(&mut self) -> Result<i8>
pub fn read_bool(&mut self) -> Result<bool>
pub fn read_i16(&mut self) -> Result<i16>
pub fn read_i32(&mut self) -> Result<i32>
pub fn read_i64(&mut self) -> Result<i64>
Sourcepub fn read_uuid(&mut self) -> Result<[u8; 16]>
pub fn read_uuid(&mut self) -> Result<[u8; 16]>
Reads a Kafka UUID from its 16-byte network-order representation.
pub fn read_f64(&mut self) -> Result<f64>
pub fn read_string(&mut self) -> Result<String>
pub fn read_nullable_string(&mut self) -> Result<Option<String>>
pub fn read_bytes(&mut self) -> Result<Vec<u8>>
pub fn read_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>
pub fn read_unsigned_varint(&mut self) -> Result<u32>
pub fn read_varint(&mut self) -> Result<i32>
pub fn read_varlong(&mut self) -> Result<i64>
pub fn read_varint_bytes(&mut self) -> Result<Vec<u8>>
pub fn read_varint_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>
pub fn read_compact_string(&mut self) -> Result<String>
pub fn read_compact_nullable_string(&mut self) -> Result<Option<String>>
pub fn read_compact_bytes(&mut self) -> Result<Vec<u8>>
pub fn read_compact_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>
pub fn read_array<T>( &mut self, kind: &'static str, read_item: impl FnMut(&mut Self) -> Result<T>, ) -> Result<Option<Vec<T>>>
pub fn read_compact_array<T>( &mut self, kind: &'static str, read_item: impl FnMut(&mut Self) -> Result<T>, ) -> Result<Option<Vec<T>>>
pub fn read_tagged_fields(&mut self) -> Result<Vec<TaggedField>>
pub fn read_exact(&mut self, length: usize) -> Result<&'a [u8]>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnsafeUnpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'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