[][src]Trait calf_vec::generic::Meta

pub trait Meta: Copy {
    const MAX_LENGTH: usize;

    fn new(len: usize, capacity: Option<usize>) -> Self;
fn len(&self) -> usize;
fn capacity(&self) -> Option<usize>;
fn set_len(&mut self, len: usize);
fn set_capacity(&mut self, capacity: Option<usize>); }

Metadata representing the length and capacity of the array.

This crate provides two implementation of this trait: wide::Meta stores the length and capacity with two usize. Then the maximum size/capacity depends on the bit-depth of the plateform. For 64-bit plateforms, this crate also provides lean::Meta that stores both the length and capacity on a single usize. As a result, the maximum size/capacity is std::u32::MAX.

Associated Constants

const MAX_LENGTH: usize

Maximum size/capacity of the array using this metadata format.

Loading content...

Required methods

fn new(len: usize, capacity: Option<usize>) -> Self

Create a new metadata from an array's length and capacity (if any).

fn len(&self) -> usize

Get the length of the array.

fn capacity(&self) -> Option<usize>

Get the capacity of the buffer, if any.

The capacity is only defined on owned buffers.

fn set_len(&mut self, len: usize)

Set the new length of the array.

fn set_capacity(&mut self, capacity: Option<usize>)

Set the new capacity of the buffer.

Loading content...

Implementors

impl Meta for Meta[src]

Loading content...