Trait truck_geometry::base::Array
pub trait Array: Index<usize, Output = Self::Element, Output = Self::Element> + IndexMut<usize> {
type Element: Copy;
fn len() -> usize;
fn from_value(value: Self::Element) -> Self;
fn sum(self) -> Self::Element
where
Self::Element: Add<Self::Element, Output = Self::Element>;
fn product(self) -> Self::Element
where
Self::Element: Mul<Self::Element, Output = Self::Element>;
fn is_finite(&self) -> bool
where
Self::Element: Float;
fn as_ptr(&self) -> *const Self::Element { ... }
fn as_mut_ptr(&mut self) -> *mut Self::Element { ... }
fn swap_elements(&mut self, i: usize, j: usize) { ... }
}
Expand description
An array containing elements of type Element
Required Associated Types§
Required Methods§
fn len() -> usize
fn len() -> usize
Get the number of elements in the array type
use cgmath::prelude::*;
use cgmath::Vector3;
assert_eq!(Vector3::<f32>::len(), 3);
fn from_value(value: Self::Element) -> Self
fn from_value(value: Self::Element) -> Self
Construct a vector from a single value, replicating it.
use cgmath::prelude::*;
use cgmath::Vector3;
assert_eq!(Vector3::from_value(1),
Vector3::new(1, 1, 1));
fn sum(self) -> Self::Elementwhere
Self::Element: Add<Self::Element, Output = Self::Element>,
fn sum(self) -> Self::Elementwhere
Self::Element: Add<Self::Element, Output = Self::Element>,
The sum of the elements of the array.
Provided Methods§
fn as_mut_ptr(&mut self) -> *mut Self::Element
fn as_mut_ptr(&mut self) -> *mut Self::Element
Get a mutable pointer to the first element of the array.
fn swap_elements(&mut self, i: usize, j: usize)
fn swap_elements(&mut self, i: usize, j: usize)
Swap the elements at indices i
and j
in-place.