pub struct Extent { /* private fields */ }
Expand description
Extent
defines the logical shape of a multidimensional space by
assigning a size to each named dimension. It abstracts away memory
layout and focuses solely on structure — what dimensions exist and
how many elements each contains.
Conceptually, it corresponds to a coordinate space in the mathematical sense.
Implementations§
Source§impl Extent
impl Extent
Sourcepub fn new(labels: Vec<String>, sizes: Vec<usize>) -> Result<Self, ExtentError>
pub fn new(labels: Vec<String>, sizes: Vec<usize>) -> Result<Self, ExtentError>
Creates a new Extent
from the given labels and sizes.
Sourcepub fn size(&self, label: &str) -> Option<usize>
pub fn size(&self, label: &str) -> Option<usize>
Returns the size of the dimension with the given label, if it exists.
Sourcepub fn position(&self, label: &str) -> Option<usize>
pub fn position(&self, label: &str) -> Option<usize>
Returns the position of the dimension with the given label, if it exists exists.
Sourcepub fn point(&self, coords: Vec<usize>) -> Result<Point, PointError>
pub fn point(&self, coords: Vec<usize>) -> Result<Point, PointError>
Creates a Point
in this extent with the given coordinates.
Returns an error if the coordinate dimensionality does not match.
Sourcepub fn point_of_rank(&self, rank: usize) -> Result<Point, PointError>
pub fn point_of_rank(&self, rank: usize) -> Result<Point, PointError>
Returns the point corresponding to the provided rank in this extent.
Sourcepub fn into_inner(self) -> (Vec<String>, Vec<usize>)
pub fn into_inner(self) -> (Vec<String>, Vec<usize>)
Convert this extent into its labels and sizes.
Sourcepub fn iter(&self) -> impl Iterator<Item = (String, usize)> + use<'_>
pub fn iter(&self) -> impl Iterator<Item = (String, usize)> + use<'_>
Iterate over this extens labels and sizes.
Sourcepub fn points(&self) -> ExtentPointsIterator<'_> ⓘ
pub fn points(&self) -> ExtentPointsIterator<'_> ⓘ
Iterate points in this extent.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Extent
impl<'de> Deserialize<'de> for Extent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Extent
impl StructuralPartialEq for Extent
Auto Trait Implementations§
impl Freeze for Extent
impl RefUnwindSafe for Extent
impl Send for Extent
impl Sync for Extent
impl Unpin for Extent
impl UnwindSafe for Extent
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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