#[repr(transparent)]pub struct Distance<T, const D: usize> {
pub dim: [T; D],
}
Expand description
๐
A separation between two locations in D
-dimensional space.
Represents a displacement vector without an absolute origin. It describes the magnitude of separation between positions.
- Unlike
Position
,Distance
is relative, and represents how far apart two positions are. - Unlike
Orientation
,Distance
has magnitude but no defined orientation.
Fieldsยง
ยงdim: [T; D]
The component-wise separation in D
-dimensional space.
Implementationsยง
Sourceยงimpl<T, const D: usize> Distance<T, D>
impl<T, const D: usize> Distance<T, D>
Sourcepub const fn new(dimensions: [T; D]) -> Self
pub const fn new(dimensions: [T; D]) -> Self
Constructs a new Distance from the given dimensions.
Sourcepub const fn as_slice(&self) -> &[T] โ
pub const fn as_slice(&self) -> &[T] โ
Returns a shared reference to the distance as a slice.
Sourcepub fn as_slice_mut(&mut self) -> &mut [T] โ
pub fn as_slice_mut(&mut self) -> &mut [T] โ
Returns an exclusive reference to the distance 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.
Returns true
if all dimensions of the distance are equal.
Trait Implementationsยง
Sourceยงimpl<T: ConstDefault, const D: usize> ConstDefault for Distance<T, D>
impl<T: ConstDefault, const D: usize> ConstDefault for Distance<T, D>
Sourceยงimpl<T> From<(T, T, T, T)> for Distance<T, 4>
impl<T> From<(T, T, T, T)> for Distance<T, 4>
Sourceยงfn from(dim: (T, T, T, T)) -> Self
fn from(dim: (T, T, T, T)) -> Self
Converts to this type from the input type.
Sourceยงimpl<T: Ord, const D: usize> Ord for Distance<T, D>
impl<T: Ord, const D: usize> Ord for Distance<T, D>
Sourceยงimpl<T: PartialOrd, const D: usize> PartialOrd for Distance<T, D>
impl<T: PartialOrd, const D: usize> PartialOrd for Distance<T, D>
impl<T: Copy, const D: usize> Copy for Distance<T, D>
impl<T: Eq, const D: usize> Eq for Distance<T, D>
Auto Trait Implementationsยง
impl<T, const D: usize> Freeze for Distance<T, D>where
T: Freeze,
impl<T, const D: usize> RefUnwindSafe for Distance<T, D>where
T: RefUnwindSafe,
impl<T, const D: usize> Send for Distance<T, D>where
T: Send,
impl<T, const D: usize> Sync for Distance<T, D>where
T: Sync,
impl<T, const D: usize> Unpin for Distance<T, D>where
T: Unpin,
impl<T, const D: usize> UnwindSafe for Distance<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
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
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
Compare self to
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
Returns a deterministic hash of the
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 = _
Know whether dropping values of this type matters, in compile-time.
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
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
Available on crate feature
unsafe_layout
only.Returns the value of type
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
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
Available on crate feature
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
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> โ
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 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> โ
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