Skip to main content

EncodeRequest

Struct EncodeRequest 

Source
pub struct EncodeRequest<'a> { /* private fields */ }
Expand description

An encoding request — binds config + image dimensions + pixel layout.

Created via LosslessConfig::encode_request or LossyConfig::encode_request.

Implementations§

Source§

impl<'a> EncodeRequest<'a>

Source

pub fn with_metadata(self, meta: &'a ImageMetadata<'a>) -> Self

Attach image metadata (ICC, EXIF, XMP).

Source

pub fn with_limits(self, limits: &'a Limits) -> Self

Attach resource limits.

Source

pub fn with_stop(self, stop: &'a dyn Stop) -> Self

Attach a cooperative cancellation token.

The encoder will check this periodically and return EncodeError::Cancelled if stopped.

Source

pub fn encode(self, pixels: &[u8]) -> Result<Vec<u8>>

Encode pixels and return the JXL bytes.

Source

pub fn encode_with_stats(self, pixels: &[u8]) -> Result<EncodeResult>

Encode pixels and return the JXL bytes together with EncodeStats.

Source

pub fn encode_into( self, pixels: &[u8], out: &mut Vec<u8>, ) -> Result<EncodeResult>

Encode pixels, appending to an existing buffer. Returns metrics.

Source

pub fn encode_to(self, pixels: &[u8], dest: impl Write) -> Result<EncodeResult>

Encode pixels, writing to a std::io::Write destination. Returns metrics.

Auto Trait Implementations§

§

impl<'a> Freeze for EncodeRequest<'a>

§

impl<'a> !RefUnwindSafe for EncodeRequest<'a>

§

impl<'a> Send for EncodeRequest<'a>

§

impl<'a> Sync for EncodeRequest<'a>

§

impl<'a> Unpin for EncodeRequest<'a>

§

impl<'a> !UnwindSafe for EncodeRequest<'a>

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.