#[repr(transparent)]pub struct Extent<T, const D: usize> {
pub size: [T; D],
}
Expand description
An orthogonal extension in D
-space without a coordinate position.
Represents the lengths of each dimension in a multi-dimensional space, providing an origin-agnostic shape with the implied form of an orthotope (generalized rectangle or box).
Fields§
§size: [T; D]
The D-dimensional size.
Implementations§
Source§impl<T, const D: usize> Extent<T, D>
impl<T, const D: usize> Extent<T, D>
Sourcepub const fn new(dimensions: [T; D]) -> Self
pub const fn new(dimensions: [T; D]) -> Self
Constructs a new Extent
from the given dimensions.
Sourcepub fn as_slice_mut(&mut self) -> &mut [T] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [T] ⓘ
Returns an exclusive reference to the extent as a slice.
Sourcepub fn is_uniform_nd(&self) -> boolwhere
T: PartialEq,
pub fn is_uniform_nd(&self) -> boolwhere
T: PartialEq,
Returns true
if all dimensions of the extent are equal.
Source§impl<T, const D: usize> Extent<T, D>
§Interval-related methods
impl<T, const D: usize> Extent<T, D>
§Interval-related methods
Sourcepub fn as_intervals(self) -> [Interval<T>; D]where
T: Default,
pub fn as_intervals(self) -> [Interval<T>; D]where
T: Default,
TODO
Sourcepub const fn as_intervals_const(self) -> [Interval<T>; D]where
T: Copy + ConstDefault,
pub const fn as_intervals_const(self) -> [Interval<T>; D]where
T: Copy + ConstDefault,
TODO
Sourcepub fn to_intervals(&self) -> [Interval<T>; D]
pub fn to_intervals(&self) -> [Interval<T>; D]
Converts each dimension into an interval from zero to the dimension’s extent.
Sourcepub fn fits_within(&self, interval: &Interval<T>) -> boolwhere
T: PartialOrd,
pub fn fits_within(&self, interval: &Interval<T>) -> boolwhere
T: PartialOrd,
Checks if each dimension of the extent is within the given interval.
Source§impl<T> Extent<T, 2>
impl<T> Extent<T, 2>
Sourcepub fn is_uniform(&self) -> boolwhere
T: PartialEq,
pub fn is_uniform(&self) -> boolwhere
T: PartialEq,
Returns true
if the 2 dimensions of the extent are equal.
Source§impl<T> Extent<T, 3>
impl<T> Extent<T, 3>
Sourcepub fn is_uniform_3d(&self) -> boolwhere
T: PartialEq,
pub fn is_uniform_3d(&self) -> boolwhere
T: PartialEq,
Returns true
if the 3 dimensions of the extent are equal.
Source§impl<const D: usize> Extent<i8, D>
impl<const D: usize> Extent<i8, D>
Sourcepub const fn c_measure(self) -> i8
pub const fn c_measure(self) -> i8
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> i8
pub const fn c_boundary(self) -> i8
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<i16, D>
impl<const D: usize> Extent<i16, D>
Sourcepub const fn c_measure(self) -> i16
pub const fn c_measure(self) -> i16
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> i16
pub const fn c_boundary(self) -> i16
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<i32, D>
impl<const D: usize> Extent<i32, D>
Sourcepub const fn c_measure(self) -> i32
pub const fn c_measure(self) -> i32
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> i32
pub const fn c_boundary(self) -> i32
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<i64, D>
impl<const D: usize> Extent<i64, D>
Sourcepub const fn c_measure(self) -> i64 ⓘ
pub const fn c_measure(self) -> i64 ⓘ
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> i64 ⓘ
pub const fn c_boundary(self) -> i64 ⓘ
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<i128, D>
impl<const D: usize> Extent<i128, D>
Sourcepub const fn c_measure(self) -> i128
pub const fn c_measure(self) -> i128
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> i128
pub const fn c_boundary(self) -> i128
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<isize, D>
impl<const D: usize> Extent<isize, D>
Sourcepub const fn c_measure(self) -> isize
pub const fn c_measure(self) -> isize
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> isize
pub const fn c_boundary(self) -> isize
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<u8, D>
impl<const D: usize> Extent<u8, D>
Sourcepub const fn c_measure(self) -> u8
pub const fn c_measure(self) -> u8
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> u8
pub const fn c_boundary(self) -> u8
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<u16, D>
impl<const D: usize> Extent<u16, D>
Sourcepub const fn c_measure(self) -> u16
pub const fn c_measure(self) -> u16
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> u16
pub const fn c_boundary(self) -> u16
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<u32, D>
impl<const D: usize> Extent<u32, D>
Sourcepub const fn c_measure(self) -> u32 ⓘ
pub const fn c_measure(self) -> u32 ⓘ
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> u32 ⓘ
pub const fn c_boundary(self) -> u32 ⓘ
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<u64, D>
impl<const D: usize> Extent<u64, D>
Sourcepub const fn c_measure(self) -> u64
pub const fn c_measure(self) -> u64
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> u64
pub const fn c_boundary(self) -> u64
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<u128, D>
impl<const D: usize> Extent<u128, D>
Sourcepub const fn c_measure(self) -> u128
pub const fn c_measure(self) -> u128
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> u128
pub const fn c_boundary(self) -> u128
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<usize, D>
impl<const D: usize> Extent<usize, D>
Sourcepub const fn c_measure(self) -> usize
pub const fn c_measure(self) -> usize
Returns the internal measure, the product of the extents.
It’s equivalent to length, area, and volume in 1, 2 and 3 dimensions.
Sourcepub const fn c_boundary(self) -> usize
pub const fn c_boundary(self) -> usize
Returns the external boundary, the sum of the extents.
It’s equivalent to 2, perimeter and surface area in 1, 2 and 3 dimensions.
Source§impl<const D: usize> Extent<f32, D>
impl<const D: usize> Extent<f32, D>
Source§impl<const D: usize> Extent<f64, D>
impl<const D: usize> Extent<f64, D>
Trait Implementations§
Source§impl<T: ConstDefault, const D: usize> ConstDefault for Extent<T, D>
impl<T: ConstDefault, const D: usize> ConstDefault for Extent<T, D>
Source§impl<T: Ord, const D: usize> Ord for Extent<T, D>
impl<T: Ord, const D: usize> Ord for Extent<T, D>
Source§impl<T: PartialOrd, const D: usize> PartialOrd for Extent<T, D>
impl<T: PartialOrd, const D: usize> PartialOrd for Extent<T, D>
impl<T: Copy, const D: usize> Copy for Extent<T, D>
impl<T: Eq, const D: usize> Eq for Extent<T, D>
Auto Trait Implementations§
impl<T, const D: usize> Freeze for Extent<T, D>where
T: Freeze,
impl<T, const D: usize> RefUnwindSafe for Extent<T, D>where
T: RefUnwindSafe,
impl<T, const D: usize> Send for Extent<T, D>where
T: Send,
impl<T, const D: usize> Sync for Extent<T, D>where
T: Sync,
impl<T, const D: usize> Unpin for Extent<T, D>where
T: Unpin,
impl<T, const D: usize> UnwindSafe for Extent<T, D>where
T: UnwindSafe,
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> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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