[−][src]Trait tinyvec::Array
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
Loading content...Associated Constants
const CAPACITY: usize
The number of slots in the thing.
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.