Skip to main content

ArrayBytesFixedDisjointView

Struct ArrayBytesFixedDisjointView 

Source
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>

Source

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

  • subset is out-of-bounds of shape, or
  • the length of bytes is not the product of the elements in shape multiplied by data_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.

Source

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.

Source

pub fn shape(&self) -> &[u64]

Return the shape of the bytes this view is created from.

Source

pub fn subset(&self) -> &ArraySubset

Return the subset of the bytes this view is created from.

Source

pub fn num_elements(&self) -> u64

Return the number of elements in the view.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn from( view: &'a mut ArrayBytesFixedDisjointView<'a>, ) -> ArrayBytesDecodeIntoTarget<'a>

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.