pub struct ChannelRowSink { /* private fields */ }Expand description
A sink that streams finished strips to the async side over a bounded
channel. Each strip is an owned [PixelBuffer]; provide_* hands the
decoder a fresh strip and ships the previous one, blocking the decode
thread while the channel is full, so a slow consumer throttles the
decoder instead of the decoder filling memory.
It blocks, so it belongs on a thread outside the runtime: a Compute
such as spawn_blocking or a rayon pool, or pull_decode_on_thread.
Under Inline the batch runs on a runtime worker, where tokio refuses
to block.
Implementations§
Source§impl ChannelRowSink
impl ChannelRowSink
Sourcepub fn new(tx: Sender<StripEvent>, provisional: bool) -> Self
pub fn new(tx: Sender<StripEvent>, provisional: bool) -> Self
A sink sending into tx. provisional says whether progressive
passes should be forwarded as they arrive.
Sourcepub fn with_pulse(self, pulse: SharedPulse) -> Self
pub fn with_pulse(self, pulse: SharedPulse) -> Self
Re-check pulse while blocked on a full channel, so a cancelled
decode is not held hostage by a consumer that stopped consuming.
Trait Implementations§
Source§impl Debug for ChannelRowSink
impl Debug for ChannelRowSink
Source§impl DecodeRowSink for ChannelRowSink
impl DecodeRowSink for ChannelRowSink
Source§fn begin(
&mut self,
width: u32,
height: u32,
descriptor: PixelDescriptor,
) -> Result<(), SinkError>
fn begin( &mut self, width: u32, height: u32, descriptor: PixelDescriptor, ) -> Result<(), SinkError>
Source§fn provide_next_buffer(
&mut self,
y: u32,
height: u32,
width: u32,
descriptor: PixelDescriptor,
) -> Result<PixelSliceMut<'_>, SinkError>
fn provide_next_buffer( &mut self, y: u32, height: u32, width: u32, descriptor: PixelDescriptor, ) -> Result<PixelSliceMut<'_>, SinkError>
y .. y + height. Read moreSource§fn accepts_provisional(&self) -> bool
fn accepts_provisional(&self) -> bool
Source§fn provide_pass_buffer(
&mut self,
meta: BatchMeta,
height: u32,
width: u32,
descriptor: PixelDescriptor,
) -> Result<PixelSliceMut<'_>, SinkError>
fn provide_pass_buffer( &mut self, meta: BatchMeta, height: u32, width: u32, descriptor: PixelDescriptor, ) -> Result<PixelSliceMut<'_>, SinkError>
meta.y .. meta.y + height of
pass meta.pass: an approximation a later pass replaces. Called only
on sinks whose accepts_provisional
returned true, never for final rows (meta.is_final is false),
and in any order relative to other provisional rows. The final rows
for the same region still arrive through
provide_next_buffer. Read more