pub struct AlignedSamples { /* private fields */ }Expand description
Owned byte storage whose first byte is guaranteed 64-byte aligned on every allocator.
Zero-copy slice borrowing works for every sample and pixel type (&[u8],
&[u16], &[f32], &[f64], &[Rgb<u16>], &[Rgba<f32>], …) because 64
is a multiple of every natural alignment. Cannot convert to Vec<T> without
copying because its deallocation alignment is 64.
Implementations§
Source§impl AlignedSamples
impl AlignedSamples
Sourcepub fn zeroed_bytes(byte_len: usize) -> Result<AlignedSamples, StorageError>
pub fn zeroed_bytes(byte_len: usize) -> Result<AlignedSamples, StorageError>
Fallibly allocate byte_len zeroed bytes on a 64-byte boundary.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Immutable byte view (guaranteed 64-byte aligned base pointer).
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Mutable byte view (guaranteed 64-byte aligned base pointer).
Sourcepub fn try_clone(&self) -> Result<AlignedSamples, StorageError>
pub fn try_clone(&self) -> Result<AlignedSamples, StorageError>
Fallibly clone the 64-byte aligned backing storage without aborting on OOM.
Trait Implementations§
Source§impl ByteStorage for AlignedSamples
impl ByteStorage for AlignedSamples
Source§impl ByteStorageMut for AlignedSamples
impl ByteStorageMut for AlignedSamples
Source§fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Mutable underlying bytes in native endianness.
Source§impl Clone for AlignedSamples
impl Clone for AlignedSamples
Source§fn clone(&self) -> AlignedSamples
fn clone(&self) -> AlignedSamples
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Freeze for AlignedSamples
impl RefUnwindSafe for AlignedSamples
impl Send for AlignedSamples
impl Sync for AlignedSamples
impl Unpin for AlignedSamples
impl UnsafeUnpin for AlignedSamples
impl UnwindSafe for AlignedSamples
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