pub struct Layout { /* private fields */ }Expand description
An array’s shape, with optional keys and a name for each axis. A layout with no keys or names holds no Meta.
Implementations§
Source§impl Layout
impl Layout
pub fn shape(&self) -> &[usize]
Sourcepub fn names(&self) -> &[Option<Arc<str>>]
pub fn names(&self) -> &[Option<Arc<str>>]
The name of each axis, with None for an axis without one. Empty when no axis has a name (has_names).
pub fn name(&self, axis: usize) -> Option<&Arc<str>>
Sourcepub fn axis_named(&self, name: &str) -> Option<usize>
pub fn axis_named(&self, name: &str) -> Option<usize>
The axis named name, if there is one.
Sourcepub fn with_names(self, names: Vec<Option<Arc<str>>>) -> Result<Layout, Error>
pub fn with_names(self, names: Vec<Option<Arc<str>>>) -> Result<Layout, Error>
The layout with names on its axes. A Rank error when the count differs from the rank, and a Domain error when a name repeats.
Sourcepub fn inherit_names(self, names: Vec<Option<Arc<str>>>) -> Layout
pub fn inherit_names(self, names: Vec<Option<Arc<str>>>) -> Layout
The layout with names, which the caller has checked: one for each axis, or none.
Sourcepub fn unique_names(self) -> Layout
pub fn unique_names(self) -> Layout
The layout without any name that appears on more than one axis.
pub fn has_keys(&self) -> bool
pub fn keys(&self, axis: usize) -> Option<&Arc<Keys>>
Sourcepub fn all_keys(&self) -> Vec<Option<Arc<Keys>>>
pub fn all_keys(&self) -> Vec<Option<Arc<Keys>>>
The keys of every axis, with None for an axis without them.
Sourcepub fn matches(&self, other: &Layout) -> bool
pub fn matches(&self, other: &Layout) -> bool
Whether shapes, assigned axis names and assigned keys match. An unlabelled axis matches either label set.
Sourcepub fn without_keys(self, axis: usize) -> Layout
pub fn without_keys(self, axis: usize) -> Layout
The layout without keys on axis.
Sourcepub fn with_keys(self, keys: Vec<Option<Arc<Keys>>>) -> Result<Layout, Error>
pub fn with_keys(self, keys: Vec<Option<Arc<Keys>>>) -> Result<Layout, Error>
The layout with keys on its axes. A Rank error when the count differs from the rank, and a Length error when an axis’s keys differ from its length.
Sourcepub fn axes(&self, axes: impl Iterator<Item = usize> + Clone) -> Layout
pub fn axes(&self, axes: impl Iterator<Item = usize> + Clone) -> Layout
The layout of axes, in that order.
Sourcepub fn contracted(&self, right: &Layout) -> Layout
pub fn contracted(&self, right: &Layout) -> Layout
The layout of a product such as +.×, which contracts the last axis of a left argument of this layout with the first axis of a right argument of right.
Sourcepub fn merged(&self, axes: Range<usize>, len: usize) -> Layout
pub fn merged(&self, axes: Range<usize>, len: usize) -> Layout
The layout with the axes in axes merged into one axis of len positions, which has no keys or name. An empty range adds that axis.
Trait Implementations§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Forget for Layout
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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