pub trait Array<K: ArrayKind, T>: Clone {
Show 14 methods
// Required methods
fn empty() -> Self;
fn len(&self) -> K::I;
fn from_slice<'a>(slice: K::Slice<'a, T>) -> Self;
fn concatenate(&self, other: &Self) -> Self;
fn fill(x: T, n: K::I) -> Self;
fn get(&self, i: K::I) -> T;
fn get_range<R: RangeBounds<K::I>>(&self, rb: R) -> K::Slice<'_, T>;
fn set_range<R: RangeBounds<K::I>>(&mut self, rb: R, v: &K::Type<T>);
fn gather(&self, idx: K::Slice<'_, K::I>) -> Self;
fn scatter(&self, idx: K::Slice<'_, K::I>, n: K::I) -> Self;
fn scatter_assign(&mut self, ixs: &K::Index, values: Self);
fn scatter_assign_constant(&mut self, ixs: &K::Index, arg: T);
// Provided methods
fn is_empty(&self) -> bool { ... }
fn to_range<R: RangeBounds<K::I>>(&self, r: R) -> Range<K::I> { ... }
}
Expand description
Required Methods§
fn from_slice<'a>(slice: K::Slice<'a, T>) -> Self
Sourcefn concatenate(&self, other: &Self) -> Self
fn concatenate(&self, other: &Self) -> Self
Concatenate two arrays
Sourcefn fill(x: T, n: K::I) -> Self
fn fill(x: T, n: K::I) -> Self
fill(x, n)
returns the array length n containing repeated element x.
Sourcefn get_range<R: RangeBounds<K::I>>(&self, rb: R) -> K::Slice<'_, T>
fn get_range<R: RangeBounds<K::I>>(&self, rb: R) -> K::Slice<'_, T>
Get a contiguous range of the underlying array as a slice.
Sourcefn set_range<R: RangeBounds<K::I>>(&mut self, rb: R, v: &K::Type<T>)
fn set_range<R: RangeBounds<K::I>>(&mut self, rb: R, v: &K::Type<T>)
Write to a contiguous range of data in an array
Sourcefn gather(&self, idx: K::Slice<'_, K::I>) -> Self
fn gather(&self, idx: K::Slice<'_, K::I>) -> Self
Gather elements of this array according to the indices. https://en.wikipedia.org/wiki/Gather/scatter_(vector_addressing)#Gather
x = self.gather(idx) // equivalent to x[i] = self[idx[i]]
Sourcefn scatter(&self, idx: K::Slice<'_, K::I>, n: K::I) -> Self
fn scatter(&self, idx: K::Slice<'_, K::I>, n: K::I) -> Self
Scatter elements of self
into a new array at indices idx
.
x = self.scatter(idx) // equivalent to x[idx[i]] = self[i]
§Panics
If there is any i ≥ n
in idx
fn scatter_assign(&mut self, ixs: &K::Index, values: Self)
Sourcefn scatter_assign_constant(&mut self, ixs: &K::Index, arg: T)
fn scatter_assign_constant(&mut self, ixs: &K::Index, arg: T)
Numpy self[ixs] = arg
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.