Struct gapbuffer::GapBuffer [] [src]

pub struct GapBuffer<T> { /* fields omitted */ }

A GapBuffer is a dynamic array which implements methods to shift the empty portion of the array around so that modifications can occur at any point in the array. It is optimized for data structures in which insertions and deletions tend to occur in sequence within the same area of the array, such as a buffer for a text editor.

Methods

impl<T> GapBuffer<T>
[src]

Constructs an empty GapBuffer.

Constructs a GapBuffer with a given initial capacity.

Get a reference to the element at the index.

Get a mutable reference to the element at the index.

Swap the elements at the index. i and j may be equal.

Panics if there is no element with either index.

Get the capacity of the GapBuffer without expanding.

Reserve at least this much additional space for the GapBuffer. The collection may reserve more space to avoid frequent reallocations.

Panics if the new capacity overflows uint.

Get an iterator of this GapBuffer.

Get the length of the GapBuffer.

Is the GapBuffer empty?

Clears the buffer, removing all values.

Insert a new T at a given index (the gap will be shifted to that index).

Panics if i is greater than VecDeque's length.

Removes and returns the element at position i from the gap buffer. The gap will be shifted to just before the index. Returns None if i is out of bounds.

Trait Implementations

impl<T: Clone> Clone for GapBuffer<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Default> Default for GapBuffer<T>
[src]

Returns the "default value" for a type. Read more

impl<A, B> PartialEq<GapBuffer<B>> for GapBuffer<A> where
    A: PartialEq<B>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<A> Eq for GapBuffer<A> where
    A: Eq
[src]

impl<A> PartialOrd for GapBuffer<A> where
    A: PartialOrd
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<A> Ord for GapBuffer<A> where
    A: Ord
[src]

This method returns an Ordering between self and other. Read more

impl<A> FromIterator<A> for GapBuffer<A>
[src]

Creates a value from an iterator. Read more

impl<A> Extend<A> for GapBuffer<A>
[src]

Extends a collection with the contents of an iterator. Read more

impl<T> Debug for GapBuffer<T> where
    T: Debug
[src]

Formats the value using the given formatter.

impl<T> Index<usize> for GapBuffer<T>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<T> IndexMut<usize> for GapBuffer<T>
[src]

The method for the mutable indexing (container[index]) operation