Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<C = Identity, E = Identity> { /* private fields */ }
Expand description

Synchronous frame decoder. It knows no logical ranges or I/O offsets. Authentication precedes decompression. Reuse one instance and the caller’s buffer to amortize allocations. Compression may swap the buffer allocation.

Implementations§

Source§

impl<C: CompressionCodec, E: EncryptionCodec> Decoder<C, E>

Source

pub fn new(config: Config, compression: C, encryption: E) -> Result<Self>

Create a decoder matching the object’s metadata and the supplied key.

Source

pub fn decode_frame( &mut self, spec: FrameSpec, buffer: &mut Vec<u8>, ) -> Result<()>

Replace one complete stored frame with its complete decoded bytes. On failure the buffer is cleared. No unauthenticated bytes are returned. Clearing the buffer is not a promise to zero its allocation or scratch.

Auto Trait Implementations§

§

impl<C, E> Freeze for Decoder<C, E>
where C: Freeze, E: Freeze,

§

impl<C, E> RefUnwindSafe for Decoder<C, E>

§

impl<C, E> Send for Decoder<C, E>
where C: Send, E: Send,

§

impl<C, E> Sync for Decoder<C, E>
where C: Sync, E: Sync,

§

impl<C, E> Unpin for Decoder<C, E>
where C: Unpin, E: Unpin,

§

impl<C, E> UnsafeUnpin for Decoder<C, E>
where C: UnsafeUnpin, E: UnsafeUnpin,

§

impl<C, E> UnwindSafe for Decoder<C, E>
where C: UnwindSafe, E: UnwindSafe,

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.