Trait common_traits::SequenceGrowable
source · 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§
sourcefn resize(&mut self, new_len: usize, value: Self::Item)
fn resize(&mut self, new_len: usize, value: Self::Item)
Resize the Sequence to the given length, filling with the given value.
sourcefn pop(&mut self) -> Option<Self::Item>
fn pop(&mut self) -> Option<Self::Item>
Remove the last element from the Sequence and return it, or None
if it is empty.
sourcefn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S)
fn extend_from<S: Sequence<Item = Self::Item>>(&mut self, other: &S)
Extend from another Sequence
Object Safety§
This trait is not object safe.