pub trait SequenceGrowable: SequenceMut {
    // Required methods
    fn resize(&mut self, new_len: usize, value: Self::Item);
    fn push(&mut self, value: Self::Item);
    fn pop(&mut self) -> Option<Self::Item>;
    fn clear(&mut self);
    fn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S);
}
Expand description

A trait for types that can be viewed as a growable sequence of copiable elements, such as Vec<T>.

The difference between this and Vec<T> is that the get method doesn’t return a reference, but a copy of the element. This allows to use transparently compressed or succint data structures as if they were slices.

Required Methods§

source

fn resize(&mut self, new_len: usize, value: Self::Item)

Resize the Sequence to the given length, filling with the given value.

source

fn push(&mut self, value: Self::Item)

Push an element to the end of the Sequence

source

fn pop(&mut self) -> Option<Self::Item>

Remove the last element from the Sequence and return it, or None if it is empty.

source

fn clear(&mut self)

Set len to 0

source

fn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S)

Extend from another Sequence

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T: Copy> SequenceGrowable for &'a mut Vec<T>

source§

fn resize(&mut self, new_len: usize, value: Self::Item)

source§

fn push(&mut self, value: Self::Item)

source§

fn pop(&mut self) -> Option<Self::Item>

source§

fn clear(&mut self)

source§

fn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S)

source§

impl<T: Copy> SequenceGrowable for Vec<T>

source§

fn resize(&mut self, new_len: usize, value: Self::Item)

source§

fn push(&mut self, value: Self::Item)

source§

fn pop(&mut self) -> Option<Self::Item>

source§

fn clear(&mut self)

source§

fn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S)

Implementors§