pub struct CollectSink { /* private fields */ }Expand description
A sink that collects every final row into one tightly packed image.
begin sizes the buffer; provide_next_buffer hands out the rows in
place, so the decoder writes straight into the final image. Final-row
coverage is tracked separately: repeated or overlapping strips cannot hide
missing rows at finish. The coverage bitmap uses eight bytes per 64 rows
(rounded up), independent of image width. Supplying a buffer does not prove
that the codec actually wrote every byte; native correctness remains required.
Implementations§
Source§impl CollectSink
impl CollectSink
Sourcepub fn descriptor(&self) -> Option<PixelDescriptor>
pub fn descriptor(&self) -> Option<PixelDescriptor>
Output descriptor, once begin has been called.
Sourcepub fn rows_written(&self) -> u64
pub fn rows_written(&self) -> u64
Rows written so far (a row written twice counts twice).
Sourcepub fn as_pixel_slice(&self) -> Option<PixelSlice<'_>>
pub fn as_pixel_slice(&self) -> Option<PixelSlice<'_>>
A zero-copy view of the collected image.
Sourcepub fn into_buffer(self) -> Option<PixelBuffer>
pub fn into_buffer(self) -> Option<PixelBuffer>
Take the finished image without copying its pixels or allocating.
Returns None before DecodeRowSink::finish succeeds. Call this only
after the driver returns success: a sink’s finish is not proof that the
decoder’s later validation succeeded. This does not include metadata;
retain the decoder’s completion details separately.
Trait Implementations§
Source§impl Debug for CollectSink
impl Debug for CollectSink
Source§impl DecodeRowSink for CollectSink
impl DecodeRowSink for CollectSink
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 finish(&mut self) -> Result<(), SinkError>
fn finish(&mut self) -> Result<(), SinkError>
Source§fn max_buffer_rows(&self) -> NonZero<u32>
fn max_buffer_rows(&self) -> NonZero<u32>
Source§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<'_>, Box<dyn Error + Send + Sync>>
fn provide_pass_buffer( &mut self, meta: BatchMeta, height: u32, width: u32, descriptor: PixelDescriptor, ) -> Result<PixelSliceMut<'_>, Box<dyn Error + Send + Sync>>
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