Struct LineSlice
pub struct LineSlice<T> { pub location: LineIndex, pub value: T }
A single line of pixels. Use [LineRef] or [LineRefMut] for easier type names.
Fields
location: LineIndexWhere this line is located inside the image.
value: TThe 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
impl LineSlice<&[u8]>
fn read_samples_into_slice<T: Data>(self, slice: &mut [T]) -> UnitResultRead the samples (f16, f32, u32 values) from this line value reference. Use
read_samplesif there is not slice available.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_sliceif you already have a slice of samples.
impl<'s> LineSlice<&'s mut [u8]>
fn write_samples_from_slice<T: Data>(self, slice: &[T]) -> UnitResultWrites the samples (f16, f32, u32 values) into this line value reference. Use
write_samplesif there is no slice available.fn write_samples<T: Data>(self, get_sample: impl FnMut(usize) -> T) -> UnitResultIterate over all samples in this line, from left to right. The supplied
get_linefunction returns the sample value for a given sample index within the line, which starts at zero for each individual line. Usewrite_samples_from_sliceif you already have a slice of samples.
Trait Implementations
impl<T: Clone> Clone for LineSlice<T>
fn clone(&self) -> Self
impl<T: Copy> Copy for LineSlice<T>
impl<T: Debug> Debug for LineSlice<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Eq> Eq for LineSlice<T>
impl<T: PartialEq> PartialEq for LineSlice<T>
fn eq(&self, other: &Self) -> bool
impl<T: PartialEq> 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> UnsafeUnpin for LineSlice<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for LineSlice<T>
where
T: UnwindSafe,
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for LineSlice<T>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for LineSlice<T>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for LineSlice<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for LineSlice<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for LineSlice<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for LineSlice<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for LineSlice<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for LineSlice<T>
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for LineSlice<T>
where
T: ?Sized,
impl<T> ToOwned for LineSlice<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for LineSlice<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for LineSlice<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for LineSlice<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>