Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Decoder<'a>

Source

pub fn new(input: &'a [u8]) -> Self

Source

pub fn with_limits(input: &'a [u8], limits: DecodeLimits) -> Self

Creates a decoder with explicit resource limits.

Source

pub const fn limits(&self) -> DecodeLimits

Returns the resource limits inherited by nested decoders.

Source

pub fn ensure_collection_length( &self, kind: &'static str, length: usize, ) -> Result<()>

Rejects a collection length before allocating storage for it.

Source

pub fn remaining(&self) -> usize

Source

pub fn position(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn read_i8(&mut self) -> Result<i8>

Source

pub fn read_bool(&mut self) -> Result<bool>

Source

pub fn read_i16(&mut self) -> Result<i16>

Source

pub fn read_i32(&mut self) -> Result<i32>

Source

pub fn read_i64(&mut self) -> Result<i64>

Source

pub fn read_uuid(&mut self) -> Result<[u8; 16]>

Reads a Kafka UUID from its 16-byte network-order representation.

Source

pub fn read_f64(&mut self) -> Result<f64>

Source

pub fn read_string(&mut self) -> Result<String>

Source

pub fn read_nullable_string(&mut self) -> Result<Option<String>>

Source

pub fn read_bytes(&mut self) -> Result<Vec<u8>>

Source

pub fn read_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>

Source

pub fn read_unsigned_varint(&mut self) -> Result<u32>

Source

pub fn read_varint(&mut self) -> Result<i32>

Source

pub fn read_varlong(&mut self) -> Result<i64>

Source

pub fn read_varint_bytes(&mut self) -> Result<Vec<u8>>

Source

pub fn read_varint_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>

Source

pub fn read_compact_string(&mut self) -> Result<String>

Source

pub fn read_compact_nullable_string(&mut self) -> Result<Option<String>>

Source

pub fn read_compact_bytes(&mut self) -> Result<Vec<u8>>

Source

pub fn read_compact_nullable_bytes(&mut self) -> Result<Option<Vec<u8>>>

Source

pub fn read_array<T>( &mut self, kind: &'static str, read_item: impl FnMut(&mut Self) -> Result<T>, ) -> Result<Option<Vec<T>>>

Source

pub fn read_compact_array<T>( &mut self, kind: &'static str, read_item: impl FnMut(&mut Self) -> Result<T>, ) -> Result<Option<Vec<T>>>

Source

pub fn read_tagged_fields(&mut self) -> Result<Vec<TaggedField>>

Source

pub fn read_exact(&mut self, length: usize) -> Result<&'a [u8]>

Trait Implementations§

Source§

impl<'a> Clone for Decoder<'a>

Source§

fn clone(&self) -> Decoder<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Decoder<'a>

Source§

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

Formats the value using the given formatter. Read more

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> 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.