pub struct LineSlice<T> {
pub location: LineIndex,
pub value: T,
}
Expand description
A single line of pixels. Use LineRef or LineRefMut for easier type names.
Fields§
§location: LineIndex
Where this line is located inside the image.
value: T
The raw bytes of the pixel line, either &[u8]
or &mut [u8]
.
Must be re-interpreted as slice of f16, f32, or u32,
according to the channel data type.
Implementations§
source§impl<'s> LineSlice<&'s mut [u8]>
impl<'s> LineSlice<&'s mut [u8]>
sourcepub fn write_samples_from_slice<T: Data>(self, slice: &[T]) -> UnitResult
pub fn write_samples_from_slice<T: Data>(self, slice: &[T]) -> UnitResult
Writes the samples (f16, f32, u32 values) into this line value reference.
Use write_samples
if there is not slice available.
sourcepub fn write_samples<T: Data>(
self,
get_sample: impl FnMut(usize) -> T,
) -> UnitResult
pub fn write_samples<T: Data>( self, get_sample: impl FnMut(usize) -> T, ) -> UnitResult
Iterate over all samples in this line, from left to right.
The supplied get_line
function returns the sample value
for a given sample index within the line,
which starts at zero for each individual line.
Use write_samples_from_slice
if you already have a slice of samples.
source§impl LineSlice<&[u8]>
impl LineSlice<&[u8]>
sourcepub fn read_samples_into_slice<T: Data>(self, slice: &mut [T]) -> UnitResult
pub fn read_samples_into_slice<T: Data>(self, slice: &mut [T]) -> UnitResult
Read the samples (f16, f32, u32 values) from this line value reference.
Use read_samples
if there is not slice available.
sourcepub fn read_samples<T: Data>(&self) -> impl Iterator<Item = Result<T>> + '_
pub fn read_samples<T: Data>(&self) -> impl Iterator<Item = Result<T>> + '_
Iterate over all samples in this line, from left to right.
Use read_sample_into_slice
if you already have a slice of samples.
Trait Implementations§
impl<T: Copy> Copy for LineSlice<T>
impl<T: Eq> Eq for LineSlice<T>
impl<T> StructuralPartialEq for LineSlice<T>
Auto Trait Implementations§
impl<T> Freeze for LineSlice<T>where
T: Freeze,
impl<T> RefUnwindSafe for LineSlice<T>where
T: RefUnwindSafe,
impl<T> Send for LineSlice<T>where
T: Send,
impl<T> Sync for LineSlice<T>where
T: Sync,
impl<T> Unpin for LineSlice<T>where
T: Unpin,
impl<T> UnwindSafe for LineSlice<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)