pub trait Vector:
Sized
+ Copy
+ Debug
+ Default
+ Index<usize>
+ PartialEq
+ Send
+ Sync {
type Axes: ArrayLength<Self::Component>;
type Component: Component;
const MIN: Self::Component;
const MAX: Self::Component;
// Required methods
fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Self::Component>;
fn get(self, index: usize) -> Option<Self::Component>;
fn to_array(self) -> GenericArray<Self::Component, Self::Axes>;
// Provided methods
fn from_slice(slice: &[Self::Component]) -> Self { ... }
fn iter(&self) -> Iter<'_, Self> ⓘ { ... }
}
Expand description
Vectors with numeric components
Required Associated Constants§
Required Associated Types§
Sourcetype Axes: ArrayLength<Self::Component>
type Axes: ArrayLength<Self::Component>
Number of axes
Required Methods§
Sourcefn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Self::Component>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Self::Component>,
Instantiate a Vector
from an iterator over Self::Component
values.
Panics of the iterator is not the correct length.
Sourcefn get(self, index: usize) -> Option<Self::Component>
fn get(self, index: usize) -> Option<Self::Component>
Get the component value for a particular index
Sourcefn to_array(self) -> GenericArray<Self::Component, Self::Axes>
fn to_array(self) -> GenericArray<Self::Component, Self::Axes>
Obtain an array of the acceleration components for each of the axes
Provided Methods§
Sourcefn from_slice(slice: &[Self::Component]) -> Self
fn from_slice(slice: &[Self::Component]) -> Self
Instantiate a vector from a slice of components.
Panics if the slice is not the right size.
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.