Skip to main content

RefEnc

Struct RefEnc 

Source
pub struct RefEnc { /* private fields */ }
Expand description

Reference single-image encoder. Supports one-shot encode and incremental push_rows + finish; declines the pull path (encode_from).

After begin the header is written at once and each pushed row is appended to the output, which pending_output exposes: the streaming encoder pattern. Without begin, rows accumulate and the file is built at finish.

Trait Implementations§

Source§

impl Encoder for RefEnc

Source§

type Error = RefError

The codec-specific error type.
Source§

fn reject(op: UnsupportedOperation) -> RefError

Convert an UnsupportedOperation into this encoder’s error type. Read more
Source§

fn preferred_strip_height(&self) -> u32

Suggested strip height for optimal row-level encoding. Read more
Source§

fn encode(self, pixels: PixelSlice<'_>) -> Result<EncodeOutput, RefError>

Encode a complete image at once (consumes self).
Source§

fn begin( &mut self, width: u32, height: u32, desc: PixelDescriptor, ) -> Result<OutputTiming, RefError>

Declare the image before the first push_rows: its full dimensions and the descriptor rows will arrive in. Returns when this encoder’s bytes will become available. Read more
Source§

fn push_rows(&mut self, rows: PixelSlice<'_>) -> Result<(), RefError>

Push scanline rows incrementally. Read more
Source§

fn pending_output(&self) -> &[u8] ⓘ

Encoded bytes ready to send, not yet consumed. Read more
Source§

fn consume_output(&mut self, n: usize)

Mark the first n bytes of pending_output as sent. An n larger than the pending length marks all of it. Default: no-op.
Source§

fn take_output(&mut self, into: &mut Vec<u8>)

Append every pending byte to into and consume it: the same as copying pending_output and calling consume_output with its length. Read more
Source§

fn finish(self) -> Result<EncodeOutput, RefError>

Finalize after push_rows. Returns encoded output. Read more
Source§

fn encode_srgba8( self, data: &mut [u8], make_opaque: bool, width: u32, height: u32, stride_pixels: u32, ) -> Result<EncodeOutput, Self::Error>

Encode from sRGB(A) 8-bit pixels provided as raw bytes. Read more
Source§

fn begin_declared( &mut self, _declaration: &EncodeDeclaration<'_>, ) -> Result<EncodePlan, Self::Error>

Start with the same complete declaration admitted during job planning. Read more
Source§

fn pull_rows( &mut self, _rows: &mut dyn EncodeRows, _pulse: Option<&dyn Pulse>, ) -> Result<PullProgress, Self::Error>

Advance an admitted encoder-driven row plan by at most one source fill. Read more
Source§

fn begin_output( &mut self, width: u32, height: u32, descriptor: PixelDescriptor, access: OutputAccess, ) -> Result<OutputTiming, Self::Error>

Prepare row encoding for actual destination access. The default uses the existing forward-only begin path without changing configuration. A patching implementation must refuse Forward before exposing bytes, report OutputTiming::with_patches, and complete with finish_output. Legacy begin/finish must never silently discard required patches. Access permits framing choices, never implicit quality/metadata changes.
Source§

fn finish_output(self) -> Result<OutputFinish<EncodeOutput>, Self::Error>

Complete negotiated output, retaining ordered patches for the driver. The default transfers the legacy finish allocation without copying. The tail retains EncodeOutput format, MIME and extension/statistics data.
Source§

fn encode_from( self, _source: &mut dyn FnMut(u32, PixelSliceMut<'_>) -> usize, ) -> Result<EncodeOutput, Self::Error>

Encode by pulling rows from a source callback. Read more

Auto Trait Implementations§

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.