Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<'d, T: Decode<C>, C: Copy = ()> { /* private fields */ }
Expand description

Resumable decoder. Input, replay, field lookup, and owner release work are charged to the caller-provided budget. Its driver brand cannot be widened even when the scanner owns every input segment.

Error retirement charges input owners, field slots, and array elements. Fixed-schema scalar destruction and allocation metadata are constant work; an arbitrary user-provided materializer or destructor must uphold its own cooperative work contract. Dropping a decoder cancels it immediately.

Implementations§

Source§

impl<'d, T: Decode> Decoder<'d, T>

Source

pub fn try_stream() -> Result<Self, Create>

Creates a decoder whose input is still being received.

Source

pub fn new(segments: Vec<Shared>) -> Result<Self, Error>

Source

pub fn one(segment: Shared) -> Result<Self, Error>

Source

pub fn from_scoped(segments: Vec<Shared<'d>>) -> Result<Self, Error>

Creates a decoder over owners which remain tied to their driver.

Source§

impl<'d, T: Decode<C>, C: Copy> Decoder<'d, T, C>

Source

pub fn try_feed(context: C) -> Result<Self, Create>

Starts streaming directly into the final output representation.

Source

pub fn push(self, segment: Shared<'d>) -> Transfer<Self, Push<'d>>

Transfers one retained transport owner into the decoder.

Source

pub fn close(self) -> Self

Declares that no more input segments can arrive.

Source

pub fn take_bytes(&mut self) -> usize

Returns original input bytes retired by scanning or scanner-error cleanup since the previous call. Materialization and cancellation retain the caller’s remaining transport credit until its terminal settlement.

Source

pub fn take_chunks(&mut self) -> Count

Returns original transport owners retired by scanning or scanner-error cleanup. Projected copies are never counted as new transport owners.

Source

pub fn release(&mut self, budget: &mut usize) -> Poll<()>

Cooperatively retires this decoder without materializing another value.

Source

pub fn poll(&mut self, budget: NonZero<usize>) -> Progress<'d, T>

Performs bounded work while preserving whether the decoder needs scheduling or another transport segment.

Auto Trait Implementations§

§

impl<'d, T, C = ()> !RefUnwindSafe for Decoder<'d, T, C>

§

impl<'d, T, C = ()> !Send for Decoder<'d, T, C>

§

impl<'d, T, C = ()> !Sync for Decoder<'d, T, C>

§

impl<'d, T, C = ()> !UnwindSafe for Decoder<'d, T, C>

§

impl<'d, T, C> Forget for Decoder<'d, T, C>

§

impl<'d, T, C> Freeze for Decoder<'d, T, C>
where Storage<Phase<'d, <T as Decode<C>>::State<'d>>>: Freeze, C: Freeze, PhantomData<fn() -> T>: Freeze,

§

impl<'d, T, C> Unpin for Decoder<'d, T, C>
where Storage<Phase<'d, <T as Decode<C>>::State<'d>>>: Unpin, C: Unpin, PhantomData<fn() -> T>: Unpin,

§

impl<'d, T, C> UnsafeUnpin for Decoder<'d, T, C>
where Storage<Phase<'d, <T as Decode<C>>::State<'d>>>: UnsafeUnpin, C: UnsafeUnpin, PhantomData<fn() -> T>: UnsafeUnpin,

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

Source§

fn into(self) -> T

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