pub trait Arraywhere
Self: Index<usize, Output = Self::Element> + IndexMut<usize, Output = Self::Element>,{
type Element: Copy;
// Required methods
fn from_value(value: Self::Element) -> Self;
fn sum(self) -> Self::Element
where Self::Element: Add<Output = <Self as Array>::Element>;
fn product(self) -> Self::Element
where Self::Element: Mul<Output = <Self as Array>::Element>;
fn min(self) -> Self::Element
where Self::Element: PartialOrd;
fn max(self) -> Self::Element
where Self::Element: PartialOrd;
// Provided methods
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§
sourcefn 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));
sourcefn sum(self) -> Self::Elementwhere
Self::Element: Add<Output = <Self as Array>::Element>,
fn sum(self) -> Self::Elementwhere Self::Element: Add<Output = <Self as Array>::Element>,
The sum of the elements of the array.
sourcefn product(self) -> Self::Elementwhere
Self::Element: Mul<Output = <Self as Array>::Element>,
fn product(self) -> Self::Elementwhere Self::Element: Mul<Output = <Self as Array>::Element>,
The product of the elements of the array.
sourcefn min(self) -> Self::Elementwhere
Self::Element: PartialOrd,
fn min(self) -> Self::Elementwhere Self::Element: PartialOrd,
The minimum element of the array.
sourcefn max(self) -> Self::Elementwhere
Self::Element: PartialOrd,
fn max(self) -> Self::Elementwhere Self::Element: PartialOrd,
The maximum element of the array.
Provided Methods§
sourcefn 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.
sourcefn 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.