pub enum BitPackingTransform<Pre, Post> {
Fail,
PassThrough,
PrePost {
norm: Pre,
denorm: Post,
},
}Expand description
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).
Implementations§
Source§impl<S> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>where
S: StorageSample,
impl<S> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>where
S: StorageSample,
Sourcepub const fn fail() -> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>
pub const fn fail() -> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>
Construct BitPackingTransform::Fail without needing closure type annotations.
Sourcepub const fn pass_through() -> BitPackingTransform<fn(BitPacking, &mut [S]), fn(BitPacking, &mut [S])>
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>
impl<Pre, Post> BitPackingTransform<Pre, Post>
Sourcepub const fn pre_post(norm: Pre, denorm: Post) -> BitPackingTransform<Pre, Post>
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>
impl<Pre, Post> Clone for BitPackingTransform<Pre, Post>
Source§fn clone(&self) -> BitPackingTransform<Pre, Post>
fn clone(&self) -> BitPackingTransform<Pre, Post>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more