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>
impl<'a, D: ControlledIncrementalDecode, S: DecodeRowSink> ControlledStepper<'a, D, S>
Sourcepub fn new(decoder: D, sink: &'a mut S) -> Self
pub fn new(decoder: D, sink: &'a mut S) -> Self
Bind a decoder to its destination; construction performs no decoding.
Sourcepub fn sink(&self) -> &S
pub fn sink(&self) -> &S
Inspect the adapter’s destination without releasing the native session.
Sourcepub fn sink_mut(&mut self) -> &mut S
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.
Sourcepub fn info(&self) -> Option<&ImageInfo>
pub fn info(&self) -> Option<&ImageInfo>
Facts currently available from the held native session.
Sourcepub fn output_descriptor(&self) -> Option<PixelDescriptor>
pub fn output_descriptor(&self) -> Option<PixelDescriptor>
Proposed output layout and interpretation, if known.
Sourcepub fn resume(
&mut self,
boundary: BoundaryId,
action: BoundaryAction,
pulse: Option<&dyn Pulse>,
) -> Result<(), StepError<D::Error>>
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>
impl<D: ControlledIncrementalDecode, S: DecodeRowSink> ByteStepper for ControlledStepper<'_, D, S>
Source§type Output = ControlledEvent
type Output = ControlledEvent
Source§fn step(
&mut self,
input: Input<'_>,
pulse: Option<&dyn Pulse>,
) -> Result<Stepped<Self::Output>, Self::Error>
fn step( &mut self, input: Input<'_>, pulse: Option<&dyn Pulse>, ) -> Result<Stepped<Self::Output>, Self::Error>
input and report what happened. None adds no
per-call control; any control retained by the stage remains active.Source§fn requested(&self) -> &[InputRequest]
fn requested(&self) -> &[InputRequest]
Step::Need. Never empty then.