pub struct ImageStore<'a, T, const N: usize>{
pub buffer: Cow<'a, [T]>,
pub channels: usize,
pub width: usize,
pub height: usize,
pub stride: usize,
pub bit_depth: usize,
}
Expand description
Fields§
§buffer: Cow<'a, [T]>
§channels: usize
Channels in the image
width: usize
Image width
height: usize
Image height
stride: usize
Image stride, if stride is zero then it considered to be width * N
bit_depth: usize
This is private field, currently used only for u16, will be automatically passed from upper func
Implementations§
Source§impl<'a, T, const N: usize> ImageStore<'a, T, N>
impl<'a, T, const N: usize> ImageStore<'a, T, N>
Sourcepub fn new(
slice_ref: Vec<T>,
width: usize,
height: usize,
) -> Result<ImageStore<'a, T, N>, PicScaleError>
pub fn new( slice_ref: Vec<T>, width: usize, height: usize, ) -> Result<ImageStore<'a, T, N>, PicScaleError>
Creates new store
Sourcepub fn borrow(
slice_ref: &'a [T],
width: usize,
height: usize,
) -> Result<ImageStore<'a, T, N>, PicScaleError>
pub fn borrow( slice_ref: &'a [T], width: usize, height: usize, ) -> Result<ImageStore<'a, T, N>, PicScaleError>
Borrows immutable slice as new image store
Sourcepub fn alloc(width: usize, height: usize) -> ImageStore<'a, T, N>
pub fn alloc(width: usize, height: usize) -> ImageStore<'a, T, N>
Allocates new owned image store
Source§impl<T, const N: usize> ImageStore<'_, T, N>
impl<T, const N: usize> ImageStore<'_, T, N>
Source§impl<'a, T, const N: usize> ImageStore<'a, T, N>
impl<'a, T, const N: usize> ImageStore<'a, T, N>
Sourcepub fn from_slice(
slice_ref: &'a [T],
width: usize,
height: usize,
) -> Result<ImageStore<'a, T, N>, PicScaleError>
pub fn from_slice( slice_ref: &'a [T], width: usize, height: usize, ) -> Result<ImageStore<'a, T, N>, PicScaleError>
Borrows immutable slice int oa new image store
Sourcepub fn copied<'b>(&self) -> ImageStore<'b, T, N>
pub fn copied<'b>(&self) -> ImageStore<'b, T, N>
Deep copy immutable image store into a new immutable store
Sourcepub fn copied_to_mut(&self, into: &mut ImageStoreMut<'_, T, N>)
pub fn copied_to_mut(&self, into: &mut ImageStoreMut<'_, T, N>)
Deep copy immutable image into mutable
Trait Implementations§
Source§impl<'a, T, const N: usize> Clone for ImageStore<'a, T, N>
impl<'a, T, const N: usize> Clone for ImageStore<'a, T, N>
Source§fn clone(&self) -> ImageStore<'a, T, N>
fn clone(&self) -> ImageStore<'a, T, N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, T, const N: usize> Freeze for ImageStore<'a, T, N>
impl<'a, T, const N: usize> RefUnwindSafe for ImageStore<'a, T, N>where
T: RefUnwindSafe,
impl<'a, T, const N: usize> Send for ImageStore<'a, T, N>
impl<'a, T, const N: usize> Sync for ImageStore<'a, T, N>where
T: Sync,
impl<'a, T, const N: usize> Unpin for ImageStore<'a, T, N>where
T: Unpin,
impl<'a, T, const N: usize> UnwindSafe for ImageStore<'a, T, N>where
T: RefUnwindSafe + 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more