# [−][src]Trait cgmath::prelude::Array

```pub trait Array where    Self: Index<usize, Output = Self::Element>,    Self: IndexMut<usize, Output = Self::Element>, {
type Element: Copy;
pub fn len() -> usize;
pub fn from_value(value: Self::Element) -> Self;
pub fn sum(self) -> Self::Element    where        Self::Element: Add<Output = Self::Element>;
pub fn product(self) -> Self::Element    where        Self::Element: Mul<Output = Self::Element>;
pub fn is_finite(&self) -> bool    where        Self::Element: Float;

pub fn as_ptr(&self) -> *const Self::Element { ... }
pub fn as_mut_ptr(&mut self) -> *mut Self::Element { ... }
pub fn swap_elements(&mut self, i: usize, j: usize) { ... }
}```

An array containing elements of type `Element`

## Required methods

### `pub fn len() -> usize`[src]

Get the number of elements in the array type

```use cgmath::prelude::*;
use cgmath::Vector3;

assert_eq!(Vector3::<f32>::len(), 3);```

### `pub fn from_value(value: Self::Element) -> Self`[src]

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));```

### `pub fn sum(self) -> Self::Element where    Self::Element: Add<Output = Self::Element>, `[src]

The sum of the elements of the array.

### `pub fn product(self) -> Self::Element where    Self::Element: Mul<Output = Self::Element>, `[src]

The product of the elements of the array.

### `pub fn is_finite(&self) -> bool where    Self::Element: Float, `[src]

Whether all elements of the array are finite

## Provided methods

### `pub fn as_ptr(&self) -> *const Self::Element`[src]

Get the pointer to the first element of the array.

### `pub fn as_mut_ptr(&mut self) -> *mut Self::Element`[src]

Get a mutable pointer to the first element of the array.

### `pub fn swap_elements(&mut self, i: usize, j: usize)`[src]

Swap the elements at indices `i` and `j` in-place.