Skip to main content

ControlledStepper

Struct ControlledStepper 

Source
pub struct ControlledStepper<'a, D, S> { /* private fields */ }
Expand description

Drive a controlled decoder with crate::SliceCursor, crate::ReadAtCursor or an async cursor, returning mandatory boundaries to the adapter.

Use this when a transcode adapter must prepare conversion, metadata and encode together while the decoder is suspended. Ordinary callers can instead use crate::PolicyDecoder to resolve each boundary automatically.

Repeated cursor calls at a suspension return the same boundary without native progress or reads. Only a matching Self::resume can continue. A native or sink failure, cancellation or unwind drops the native session, so retaining this adapter does not retain its managed buffers after failure.

Implementations§

Source§

impl<'a, D: ControlledIncrementalDecode, S: DecodeRowSink> ControlledStepper<'a, D, S>

Source

pub fn new(decoder: D, sink: &'a mut S) -> Self

Bind a decoder to its destination; construction performs no decoding.

Source

pub fn sink(&self) -> &S

Inspect the adapter’s destination without releasing the native session.

Source

pub fn sink_mut(&mut self) -> &mut S

Configure a destination while the native session is suspended, for example by installing the selected conversion and encoder together. This does not resume the decoder or approve an interpretation.

Source

pub fn info(&self) -> Option<&ImageInfo>

Facts currently available from the held native session.

Source

pub fn output_descriptor(&self) -> Option<PixelDescriptor>

Proposed output layout and interpretation, if known.

Source

pub fn resume( &mut self, boundary: BoundaryId, action: BoundaryAction, pulse: Option<&dyn Pulse>, ) -> Result<(), StepError<D::Error>>

Apply a decision to the exact held boundary. This resumes the protocol; the cursor’s next call performs subsequent native work. None adds no per-call control and preserves native retained controls.

Trait Implementations§

Source§

impl<D: ControlledIncrementalDecode, S: DecodeRowSink> ByteStepper for ControlledStepper<'_, D, S>

Source§

type Output = ControlledEvent

What a productive step yields: an image decode event, a demuxed packet.
Source§

type Error = StepError<<D as IncrementalDecode>::Error>

The stage’s error.
Source§

fn step( &mut self, input: Input<'_>, pulse: Option<&dyn Pulse>, ) -> Result<Stepped<Self::Output>, Self::Error>

Take a prefix of input and report what happened. None adds no per-call control; any control retained by the stage remains active.
Source§

fn requested(&self) -> &[InputRequest]

What the stage needs next, after a Step::Need. Never empty then.

Auto Trait Implementations§

§

impl<'a, D, S> !UnwindSafe for ControlledStepper<'a, D, S>

§

impl<'a, D, S> Freeze for ControlledStepper<'a, D, S>
where D: Freeze,

§

impl<'a, D, S> RefUnwindSafe for ControlledStepper<'a, D, S>

§

impl<'a, D, S> Send for ControlledStepper<'a, D, S>
where S: Send, D: Send,

§

impl<'a, D, S> Sync for ControlledStepper<'a, D, S>
where S: Sync, D: Sync,

§

impl<'a, D, S> Unpin for ControlledStepper<'a, D, S>
where D: Unpin,

§

impl<'a, D, S> UnsafeUnpin for ControlledStepper<'a, D, S>
where D: 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> 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 = 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.