Skip to main content

BitPackingTransform

Enum BitPackingTransform 

Source
pub enum BitPackingTransform<Pre, Post> {
    Fail,
    PassThrough,
    PrePost {
        norm: Pre,
        denorm: Post,
    },
}
Expand description

Full re-export of zenpixels core types (zero module name collisions!). Policy controlling how scoped in-place row mutation (PixelBuf::mutate_rows_with_packing, PixelViewMut::mutate_rows_with_packing) handles non-BitPacking::Full layouts.

When layout.packing == BitPacking::Full, all variants execute directly in place with zero pre/post overhead.

Variants§

§

Fail

Refuse non-BitPacking::Full layouts with BufferError::IncompatibleLayout before copy-on-write promotion or clearing SampleClaims.

§

PassThrough

Hand raw container words to the mutator as-is (still enforcing S::SAMPLE_TYPE).

§

PrePost

For non-BitPacking::Full layouts, run norm(packing, row) on each row before the user closure and unconditionally run denorm(packing, row) afterwards (including on Err or unwind so rows are never left in an intermediate normalized state).

Fields

§norm: Pre

Pre-processing normalization lambda (e.g. unpack P010 / U10_LSB to full-scale u16).

§denorm: Post

Post-processing denormalization lambda (e.g. repack full-scale u16 to P010 / U10_LSB).

Implementations§

Source§

impl<S> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>
where S: StorageSample,

Source

pub const fn fail() -> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>

Construct BitPackingTransform::Fail without needing closure type annotations.

Source

pub const fn pass_through() -> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>

Construct BitPackingTransform::PassThrough without needing closure type annotations.

Source§

impl<Pre, Post> BitPackingTransform<Pre, Post>

Source

pub const fn pre_post(norm: Pre, denorm: Post) -> BitPackingTransform<Pre, Post>

Construct BitPackingTransform::PrePost with explicit norm and denorm lambdas.

Trait Implementations§

Source§

impl<Pre, Post> Clone for BitPackingTransform<Pre, Post>
where Pre: Clone, Post: Clone,

Source§

fn clone(&self) -> BitPackingTransform<Pre, Post>

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<Pre, Post> Copy for BitPackingTransform<Pre, Post>
where Pre: Copy, Post: Copy,

Source§

impl<Pre, Post> Debug for BitPackingTransform<Pre, Post>
where Pre: Debug, Post: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Pre, Post> Freeze for BitPackingTransform<Pre, Post>
where Pre: Freeze, Post: Freeze,

§

impl<Pre, Post> RefUnwindSafe for BitPackingTransform<Pre, Post>
where Pre: RefUnwindSafe, Post: RefUnwindSafe,

§

impl<Pre, Post> Send for BitPackingTransform<Pre, Post>
where Pre: Send, Post: Send,

§

impl<Pre, Post> Sync for BitPackingTransform<Pre, Post>
where Pre: Sync, Post: Sync,

§

impl<Pre, Post> Unpin for BitPackingTransform<Pre, Post>
where Pre: Unpin, Post: Unpin,

§

impl<Pre, Post> UnsafeUnpin for BitPackingTransform<Pre, Post>
where Pre: UnsafeUnpin, Post: UnsafeUnpin,

§

impl<Pre, Post> UnwindSafe for BitPackingTransform<Pre, Post>
where Pre: UnwindSafe, Post: UnwindSafe,

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.