pub struct ArrayBytesFixedDisjointView<'a> { /* private fields */ }Expand description
A disjoint view of the bytes in an array with a fixed-length data type.
The subset represented by this view must not overlap with the subset of any other created views that reference the same array bytes.
Implementations§
Source§impl<'a> ArrayBytesFixedDisjointView<'a>
impl<'a> ArrayBytesFixedDisjointView<'a>
Sourcepub unsafe fn new(
bytes: UnsafeCellSlice<'a, u8>,
data_type_size: usize,
shape: &'a [u64],
subset: ArraySubset,
) -> Result<ArrayBytesFixedDisjointView<'a>, ArrayBytesFixedDisjointViewCreateError>
pub unsafe fn new( bytes: UnsafeCellSlice<'a, u8>, data_type_size: usize, shape: &'a [u64], subset: ArraySubset, ) -> Result<ArrayBytesFixedDisjointView<'a>, ArrayBytesFixedDisjointViewCreateError>
Create a new non-overlapping view of the bytes in an array.
§Errors
Returns ArrayBytesFixedDisjointViewCreateError if
subsetis out-of-bounds ofshape, or- the length of
bytesis not the product of the elements inshapemultiplied bydata_type_size.
§Safety
The subset represented by this view must not overlap with the subset of any other created views that reference the same array bytes.
§Panics
Panics if the product of the elements in shape multiplied by data_type_size exceeds usize::MAX.
Sourcepub unsafe fn subdivide(
&self,
subset: ArraySubset,
) -> Result<ArrayBytesFixedDisjointView<'a>, ArrayBytesFixedDisjointViewCreateError>
pub unsafe fn subdivide( &self, subset: ArraySubset, ) -> Result<ArrayBytesFixedDisjointView<'a>, ArrayBytesFixedDisjointViewCreateError>
Create a new non-overlapping view of the bytes in an array that is a subset of the current view.
§Errors
Returns SubsetOutOfBoundsError if subset is out-of-bounds of the parent subset.
§Safety
The subset represented by this view must not overlap with the subset of any other created views that reference the same array bytes.
Sourcepub fn subset(&self) -> &ArraySubset
pub fn subset(&self) -> &ArraySubset
Return the subset of the bytes this view is created from.
Sourcepub fn num_elements(&self) -> u64
pub fn num_elements(&self) -> u64
Return the number of elements in the view.
Sourcepub fn num_contiguous_elements(&self) -> usize
pub fn num_contiguous_elements(&self) -> usize
Return the contiguous element length of the view.
This is the number of elements that are accessed in a single contiguous block.
Sourcepub fn contiguous_bytes_len(&self) -> usize
pub fn contiguous_bytes_len(&self) -> usize
Return the size in bytes of contiguous elements in the view.
This is the number of elements that are accessed in a single contiguous block.
Sourcepub fn fill(&mut self, fill_value: &[u8]) -> Result<(), InvalidBytesLengthError>
pub fn fill(&mut self, fill_value: &[u8]) -> Result<(), InvalidBytesLengthError>
Fill the view with the fill value.
§Errors
Returns InvalidBytesLengthError if the length of the fill_value does not match the data type size.
§Panics
Panics if an offset into the internal bytes reference exceeds usize::MAX.
Sourcepub fn copy_from_slice(
&mut self,
subset_bytes: &[u8],
) -> Result<(), InvalidBytesLengthError>
pub fn copy_from_slice( &mut self, subset_bytes: &[u8], ) -> Result<(), InvalidBytesLengthError>
Copy bytes into the view.
The subset_bytes must be the same length as the byte length of the elements in the view.
§Errors
Returns an InvalidBytesLengthError if the length of subset_bytes is not the same as the byte length of the elements in the view.
§Panics
Panics if an offset into the internal bytes reference exceeds usize::MAX.
Trait Implementations§
Source§impl<'a> From<&'a mut ArrayBytesFixedDisjointView<'a>> for ArrayBytesDecodeIntoTarget<'a>
impl<'a> From<&'a mut ArrayBytesFixedDisjointView<'a>> for ArrayBytesDecodeIntoTarget<'a>
Source§fn from(
view: &'a mut ArrayBytesFixedDisjointView<'a>,
) -> ArrayBytesDecodeIntoTarget<'a>
fn from( view: &'a mut ArrayBytesFixedDisjointView<'a>, ) -> ArrayBytesDecodeIntoTarget<'a>
Auto Trait Implementations§
impl<'a> Freeze for ArrayBytesFixedDisjointView<'a>
impl<'a> Send for ArrayBytesFixedDisjointView<'a>
impl<'a> Sync for ArrayBytesFixedDisjointView<'a>
impl<'a> !RefUnwindSafe for ArrayBytesFixedDisjointView<'a>
impl<'a> Unpin for ArrayBytesFixedDisjointView<'a>
impl<'a> UnsafeUnpin for ArrayBytesFixedDisjointView<'a>
impl<'a> !UnwindSafe for ArrayBytesFixedDisjointView<'a>
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> 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>
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>
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