Struct comp_sci::data_structures::heap_array::HeapArray [-]  [+] [src]

pub struct HeapArray<A> {
    // some fields omitted
}

An implementation of a fixed-size mutable array, which is allocated on the heap.

Minimum memory requirement is two pointer sized integers, e.g. 16-bytes on 64-bit system.

Methods

impl<A> HeapArray<A>

fn with_capacity(capacity: usize) -> HeapArray<A>

Creates a new HeapArray by allocating the given amount of capacity.

There is no way to increase or decrease capacity afterwards.

fn as_mut_slice<'a>(&'a mut self) -> &'a mut [A]

fn copy(&self, capacity: usize) -> HeapArray<A>

Creates a new array with the given capacity and copies the contents to it.

fn swap(&mut self, a: usize, b: usize)

Swaps the elements at given indices.

fn capacity(&self) -> usize

Returns the capacity for this array.

Trait Implementations

impl<A> AsSlice<A> for HeapArray<A>

fn as_slice<'a>(&'a self) -> &'a [A]

impl<A> Index<usize> for HeapArray<A>

type Output = A

fn index<'a>(&'a self, index: &usize) -> &'a A

impl<A> IndexMut<usize> for HeapArray<A>

type Output = A

fn index_mut<'a>(&'a mut self, index: &usize) -> &'a mut A