numcodecs

Enum AnyArrayBase

Source
#[non_exhaustive]
pub enum AnyArrayBase<T: AnyRawData> { U8(ArrayBase<T::U8, IxDyn>), U16(ArrayBase<T::U16, IxDyn>), U32(ArrayBase<T::U32, IxDyn>), U64(ArrayBase<T::U64, IxDyn>), I8(ArrayBase<T::I8, IxDyn>), I16(ArrayBase<T::I16, IxDyn>), I32(ArrayBase<T::I32, IxDyn>), I64(ArrayBase<T::I64, IxDyn>), F32(ArrayBase<T::F32, IxDyn>), F64(ArrayBase<T::F64, IxDyn>), }
Expand description

Numeric n-dimensional arrays with dynamic shapes.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Implementations§

Source§

impl<T: AnyRawData> AnyArrayBase<T>

Source

pub fn len(&self) -> usize

Returns the total number of elements in the array.

Source

pub fn is_empty(&self) -> bool

Returns whether the array has any elements.

Source

pub const fn dtype(&self) -> AnyArrayDType

Returns the dtype of the array.

Source

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

Returns the shape of the array.

Source

pub fn strides(&self) -> &[isize]

Return the strides of the array.

Source

pub const fn as_typed<U: ArrayDType>( &self, ) -> Option<&ArrayBase<U::RawData<T>, IxDyn>>

Returns the U-typed array in Some(_) iff the dtype of U matches the dtype of this array. Returns None otherwise.

Source

pub fn as_typed_mut<U: ArrayDType>( &mut self, ) -> Option<&mut ArrayBase<U::RawData<T>, IxDyn>>

Returns the U-typed array in Some(_) iff the dtype of U matches the dtype of this array. Returns None otherwise.

Source§

impl<T: AnyRawData> AnyArrayBase<T>
where T::U8: Data, T::U16: Data, T::U32: Data, T::U64: Data, T::I8: Data, T::I16: Data, T::I32: Data, T::I64: Data, T::F32: Data, T::F64: Data,

Source

pub fn view(&self) -> AnyArrayView<'_>

Returns a read-only view of the array.

Source

pub fn cow(&self) -> AnyCowArray<'_>

Returns a copy-on-write view of the array.

Source

pub fn into_owned(self) -> AnyArray

Turns the array into a uniquely owned array, cloning the array elements if necessary.

Source

pub fn as_bytes(&self) -> Cow<'_, [u8]>

Returns the array’s data as a byte slice.

If the array is contiguous and in standard order, i.e. if the element order in memory corresponds to the logical order of the array’s elements, a view of the data is returned without cloning.

Otherwise, the data is cloned and put into standard order first.

Source§

impl<T: AnyRawData> AnyArrayBase<T>
where T::U8: DataMut, T::U16: DataMut, T::U32: DataMut, T::U64: DataMut, T::I8: DataMut, T::I16: DataMut, T::I32: DataMut, T::I64: DataMut, T::F32: DataMut, T::F64: DataMut,

Source

pub fn view_mut(&mut self) -> AnyArrayViewMut<'_>

Returns a read-write view of the array.

Source

pub fn with_bytes_mut<O>(&mut self, with: impl FnOnce(&mut [u8]) -> O) -> O

Provides access to the array’s data as a mutable byte slice.

If the array is contiguous and in standard order, i.e. if the element order in memory corresponds to the logical order of the array’s elements, a mutable view of the data is returned without cloning.

Otherwise, the data is cloned and put into standard order first, and later copied back into the array.

Source

pub fn assign<U: AnyRawData>( &mut self, src: &AnyArrayBase<U>, ) -> Result<(), AnyArrayAssignError>
where U::U8: Data, U::U16: Data, U::U32: Data, U::U64: Data, U::I8: Data, U::I16: Data, U::I32: Data, U::I64: Data, U::F32: Data, U::F64: Data,

Perform an elementwise assignment to self from src.

§Errors

Errors with

Source§

impl AnyArrayBase<OwnedRepr<()>>

Source

pub fn zeros(dtype: AnyArrayDType, shape: &[usize]) -> Self

Create an array with zeros of dtype and shape shape.

Source

pub fn with_zeros_bytes<T>( dtype: AnyArrayDType, shape: &[usize], with: impl FnOnce(&mut [u8]) -> T, ) -> (Self, T)

Create an array with zeros of dtype and shape shape, and provide mutable access to the bytes of the array.

The array is created to be contiguous and in standard order, i.e. its element order in memory corresponds to the logical order of the array’s elements.

Source

pub fn into_cow(self) -> AnyCowArray<'static>

Returns an owned copy-on-write array.

Trait Implementations§

Source§

impl<T: AnyRawData> Clone for AnyArrayBase<T>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: AnyRawData> Debug for AnyArrayBase<T>
where T::U8: Data, T::U16: Data, T::U32: Data, T::U64: Data, T::I8: Data, T::I16: Data, T::I32: Data, T::I64: Data, T::F32: Data, T::F64: Data,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: AnyRawData> PartialEq for AnyArrayBase<T>
where T::U8: Data, T::U16: Data, T::U32: Data, T::U64: Data, T::I8: Data, T::I16: Data, T::I32: Data, T::I64: Data, T::F32: Data, T::F64: Data,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T> Freeze for AnyArrayBase<T>
where <T as AnyRawData>::U8: Freeze, <T as AnyRawData>::U16: Freeze, <T as AnyRawData>::U32: Freeze, <T as AnyRawData>::U64: Freeze, <T as AnyRawData>::I8: Freeze, <T as AnyRawData>::I16: Freeze, <T as AnyRawData>::I32: Freeze, <T as AnyRawData>::I64: Freeze, <T as AnyRawData>::F32: Freeze, <T as AnyRawData>::F64: Freeze,

§

impl<T> RefUnwindSafe for AnyArrayBase<T>

§

impl<T> Send for AnyArrayBase<T>
where <T as AnyRawData>::U8: Send + Data, <T as AnyRawData>::U16: Send + Data, <T as AnyRawData>::U32: Send + Data, <T as AnyRawData>::U64: Send + Data, <T as AnyRawData>::I8: Send + Data, <T as AnyRawData>::I16: Send + Data, <T as AnyRawData>::I32: Send + Data, <T as AnyRawData>::I64: Send + Data, <T as AnyRawData>::F32: Send + Data, <T as AnyRawData>::F64: Send + Data,

§

impl<T> Sync for AnyArrayBase<T>
where <T as AnyRawData>::U8: Sync + Data, <T as AnyRawData>::U16: Sync + Data, <T as AnyRawData>::U32: Sync + Data, <T as AnyRawData>::U64: Sync + Data, <T as AnyRawData>::I8: Sync + Data, <T as AnyRawData>::I16: Sync + Data, <T as AnyRawData>::I32: Sync + Data, <T as AnyRawData>::I64: Sync + Data, <T as AnyRawData>::F32: Sync + Data, <T as AnyRawData>::F64: Sync + Data,

§

impl<T> Unpin for AnyArrayBase<T>
where <T as AnyRawData>::U8: Unpin, <T as AnyRawData>::U16: Unpin, <T as AnyRawData>::U32: Unpin, <T as AnyRawData>::U64: Unpin, <T as AnyRawData>::I8: Unpin, <T as AnyRawData>::I16: Unpin, <T as AnyRawData>::I32: Unpin, <T as AnyRawData>::I64: Unpin, <T as AnyRawData>::F32: Unpin, <T as AnyRawData>::F64: Unpin,

§

impl<T> UnwindSafe for AnyArrayBase<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.