Skip to main content

CodePlane

Struct CodePlane 

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

Integer codes of one component in a borrowed plane, without normalization or color claims.

Code depth and bit placement come from SampleEncoding; padding bits are ignored on read. Nothing is copied or allocated.

Implementations§

Source§

impl CodePlane<'_>

Source

pub fn hash_with(&self, inclusions: HashInclusions) -> u64

Compute a portable XXH3 fingerprint of the unpacked integer codes in this plane.

Source§

impl<'a> CodePlane<'a>

Source

pub fn from_u8( data: &'a [u8], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>

Borrow a single-component u8 plane (stride_words >= width_pixels).

Source

pub fn component_from_u8( data: &'a [u8], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>

Borrow one component of an interleaved u8 plane described by layout.

Source

pub fn from_u16( data: &'a [u16], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>

Borrow a single-component u16 plane (stride_words >= width_pixels).

Source

pub fn component_from_u16( data: &'a [u16], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>

Borrow one component of an interleaved u16 plane described by layout.

Source

pub fn from_plane_view( plane: PlaneView<'a>, component_index: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>

Borrow component component_index from a validated PlaneView<'a> zero-copy.

Source

pub const fn width(self) -> usize

Active samples per row.

Source

pub const fn height(self) -> usize

Number of active rows.

Source

pub const fn encoding(self) -> SampleEncoding

Storage width, code depth, and bit placement.

Source

pub fn code(self, x: usize, y: usize) -> Option<u16>

Extract one code, ignoring padding bits; outside the active plane returns None.

Source

pub fn read_codes( self, x: usize, y: usize, codes: &mut [u16], ) -> Result<(), CodePlaneError>

Extract codes.len() consecutive codes of row y starting at column x.

Padding bits are ignored. Validates bounds before writing; on error codes is unchanged.

Trait Implementations§

Source§

impl<'a> Clone for CodePlane<'a>

Source§

fn clone(&self) -> CodePlane<'a>

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<'a> Copy for CodePlane<'a>

Source§

impl<'a> Debug for CodePlane<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CodePlane<'a>

§

impl<'a> RefUnwindSafe for CodePlane<'a>

§

impl<'a> Send for CodePlane<'a>

§

impl<'a> Sync for CodePlane<'a>

§

impl<'a> Unpin for CodePlane<'a>

§

impl<'a> UnsafeUnpin for CodePlane<'a>

§

impl<'a> UnwindSafe for CodePlane<'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> 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.