pub struct AlignedByteSlice { /* private fields */ }Expand description
An alignment-aware byte slice that guarantees 16-byte alignment for
tensor weight mapping. If the source bytes are already aligned, it
wraps them directly. If misaligned, it copies into an AlignedPool.
Implementations§
Source§impl AlignedByteSlice
impl AlignedByteSlice
Sourcepub fn from_bytes(data: Rc<Vec<u8>>) -> Self
pub fn from_bytes(data: Rc<Vec<u8>>) -> Self
Create an aligned byte slice from raw bytes.
If the data is already 16-byte aligned, no copy is performed. If misaligned, the data is copied into an aligned pool and a warning flag is set.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get the aligned bytes. If a copy was needed, returns the pool’s bytes; otherwise returns the original directly.
Sourcepub fn was_realigned(&self) -> bool
pub fn was_realigned(&self) -> bool
Whether a copy was required for alignment.
Trait Implementations§
Source§impl Clone for AlignedByteSlice
impl Clone for AlignedByteSlice
Source§fn clone(&self) -> AlignedByteSlice
fn clone(&self) -> AlignedByteSlice
Returns a duplicate 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 moreSource§impl Debug for AlignedByteSlice
impl Debug for AlignedByteSlice
Auto Trait Implementations§
impl Freeze for AlignedByteSlice
impl RefUnwindSafe for AlignedByteSlice
impl !Send for AlignedByteSlice
impl !Sync for AlignedByteSlice
impl Unpin for AlignedByteSlice
impl UnsafeUnpin for AlignedByteSlice
impl UnwindSafe for AlignedByteSlice
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