[][src]Trait tinyvec::Array

pub trait Array {
    type Item: Default;

    const CAPACITY: usize;

    fn slice(&self) -> &[Self::Item];
fn slice_mut(&mut self) -> &mut [Self::Item]; }

A trait for types that can be the backing store of an ArrayVec.

An "array", for our purposes, has the following basic properties:

  • Owns some number of elements.
  • The element type can be generic, but must implement Default.
  • The capacity is fixed based on the array type.
  • You can get a shared or mutable slice to the elements.

You are generally note expected to need to implement this yourself. It is already implemented for all the major array lengths. Additional lengths can probably be added upon request.

Safety Reminder

As a reminder, this trait is 100% safe, which means that unsafe code must not rely on an instance of the trait being correct to avoid UB.

Associated Types

type Item: Default

The type of the items in the thing.

Loading content...

Associated Constants

const CAPACITY: usize

The number of slots in the thing.

Loading content...

Required methods

fn slice(&self) -> &[Self::Item]

Gives a shared slice over the whole thing.

A correct implementation will return a slice with a length equal to the CAPACITY value.

fn slice_mut(&mut self) -> &mut [Self::Item]

Gives a unique slice over the whole thing.

A correct implementation will return a slice with a length equal to the CAPACITY value.

Loading content...

Implementors

impl<T: Default> Array for [T; 0][src]

type Item = T

impl<T: Default> Array for [T; 1][src]

type Item = T

impl<T: Default> Array for [T; 2][src]

type Item = T

impl<T: Default> Array for [T; 3][src]

type Item = T

impl<T: Default> Array for [T; 4][src]

type Item = T

impl<T: Default> Array for [T; 5][src]

type Item = T

impl<T: Default> Array for [T; 6][src]

type Item = T

impl<T: Default> Array for [T; 7][src]

type Item = T

impl<T: Default> Array for [T; 8][src]

type Item = T

impl<T: Default> Array for [T; 9][src]

type Item = T

impl<T: Default> Array for [T; 10][src]

type Item = T

impl<T: Default> Array for [T; 11][src]

type Item = T

impl<T: Default> Array for [T; 12][src]

type Item = T

impl<T: Default> Array for [T; 13][src]

type Item = T

impl<T: Default> Array for [T; 14][src]

type Item = T

impl<T: Default> Array for [T; 15][src]

type Item = T

impl<T: Default> Array for [T; 16][src]

type Item = T

impl<T: Default> Array for [T; 17][src]

type Item = T

impl<T: Default> Array for [T; 18][src]

type Item = T

impl<T: Default> Array for [T; 19][src]

type Item = T

impl<T: Default> Array for [T; 20][src]

type Item = T

impl<T: Default> Array for [T; 21][src]

type Item = T

impl<T: Default> Array for [T; 22][src]

type Item = T

impl<T: Default> Array for [T; 23][src]

type Item = T

impl<T: Default> Array for [T; 24][src]

type Item = T

impl<T: Default> Array for [T; 25][src]

type Item = T

impl<T: Default> Array for [T; 26][src]

type Item = T

impl<T: Default> Array for [T; 27][src]

type Item = T

impl<T: Default> Array for [T; 28][src]

type Item = T

impl<T: Default> Array for [T; 29][src]

type Item = T

impl<T: Default> Array for [T; 30][src]

type Item = T

impl<T: Default> Array for [T; 31][src]

type Item = T

impl<T: Default> Array for [T; 32][src]

type Item = T

impl<T: Default> Array for [T; 33][src]

type Item = T

impl<T: Default> Array for [T; 64][src]

type Item = T

impl<T: Default> Array for [T; 128][src]

type Item = T

impl<T: Default> Array for [T; 256][src]

type Item = T

impl<T: Default> Array for [T; 512][src]

type Item = T

impl<T: Default> Array for [T; 1024][src]

type Item = T

impl<T: Default> Array for [T; 2048][src]

type Item = T

impl<T: Default> Array for [T; 4096][src]

type Item = T

Loading content...