Skip to main content

CompactionReport

Struct CompactionReport 

Source
#[non_exhaustive]
pub struct CompactionReport { /* private fields */ }
Expand description

Which channels and precision of a buffer’s declared PixelFormat are required to represent its current pixel values without loss.

Each field is Option<bool>:

  • Some(false) — measured redundant (safe to drop/narrow without loss).
  • Some(true) — measured required (keep).
  • None — predicate did not apply / was not assessed (keep conservatively).

Implementations§

Source§

impl CompactionReport

Source

pub const fn requires_alpha(&self) -> Option<bool>

Whether the measured image requires its alpha channel.

Source

pub const fn requires_chroma(&self) -> Option<bool>

Whether the measured image requires chroma.

Source

pub const fn requires_u16_precision(&self) -> Option<bool>

Whether the measured image requires 16-bit precision.

Source

pub const fn any_analyzed(&self) -> bool

Whether at least one predicate ran or answered structurally.

Source

pub fn candidate_format(&self, src: &PixelFormat) -> PixelFormat

Compute the narrowest candidate PixelFormat justified by this report (metadata only; does not inspect or transform pixels). Pass the format of the image used to produce this report. The candidate describes that image only.

Order of reduction:

  1. Full-range U16 -> U8 when requires_u16_precision == Some(false).
  2. Alpha/padding drop (RGBA/BGRA/RGBX/BGRX -> RGB, GrayAlpha -> Gray) when requires_alpha == Some(false).
  3. Chroma drop (RGB/BGR -> Gray, RGBA/BGRA/RGBX/BGRX -> GrayAlpha/Gray) when requires_chroma == Some(false) (only on structured D65 Rgb / Gray; ColorSpace::Icc chroma collapse is gated separately by ICC class swapping).
Source§

impl CompactionReport

Source

pub fn measure(view: &PixelView<'_>) -> Self

Measure which dimensions of view’s spec are actually required by its pixel values.

Source

pub fn measure_with_pulse( view: &PixelView<'_>, pulse: Option<&dyn Pulse>, ) -> Result<Self, At<ConvertError>>

Measure which dimensions of view’s spec are actually required by its pixel values, observing optional cooperative cancellation and row progress via pulse (pass None when not needed).

Trait Implementations§

Source§

impl Clone for CompactionReport

Source§

fn clone(&self) -> CompactionReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CompactionReport

Source§

impl Debug for CompactionReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CompactionReport

Source§

fn default() -> CompactionReport

Returns the “default value” for a type. Read more
Source§

impl Eq for CompactionReport

Source§

impl PartialEq for CompactionReport

Source§

fn eq(&self, other: &CompactionReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CompactionReport

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.