Trait acgmath::prelude::Array
[−]
[src]
pub trait Array where
Self: Index<usize, Output = Self::Element>,
Self: IndexMut<usize, Output = Self::Element>, { type Element: Copy; fn from_value(value: Self::Element) -> Self; fn sum(self) -> Self::Element
where
Self::Element: Add<Output = Self::Element>; fn product(self) -> Self::Element
where
Self::Element: Mul<Output = Self::Element>; fn min(self) -> Self::Element
where
Self::Element: PartialOrd; fn max(self) -> Self::Element
where
Self::Element: PartialOrd; 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) { ... } }
An array containing elements of type Element
Associated Types
Required Methods
fn from_value(value: Self::Element) -> Self
Construct a vector from a single value, replicating it.
use acgmath::prelude::*; use acgmath::Vector3; assert_eq!(Vector3::from_value(1), Vector3::new(1, 1, 1));
fn sum(self) -> Self::Element where
Self::Element: Add<Output = Self::Element>,
Self::Element: Add<Output = Self::Element>,
The sum of the elements of the array.
fn product(self) -> Self::Element where
Self::Element: Mul<Output = Self::Element>,
Self::Element: Mul<Output = Self::Element>,
The product of the elements of the array.
fn min(self) -> Self::Element where
Self::Element: PartialOrd,
Self::Element: PartialOrd,
The minimum element of the array.
fn max(self) -> Self::Element where
Self::Element: PartialOrd,
Self::Element: PartialOrd,
The maximum element of the array.
Provided Methods
fn as_ptr(&self) -> *const Self::Element
Get the pointer to the first element of the array.
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)
Swap the elements at indices i
and j
in-place.