Trait smallvec::ExtendFromSlice
source · [−]pub trait ExtendFromSlice<T> {
fn extend_from_slice(&mut self, other: &[T]);
}
Expand description
Trait to be implemented by a collection that can be extended from a slice
Example
use smallvec::{ExtendFromSlice, SmallVec};
fn initialize<V: ExtendFromSlice<u8>>(v: &mut V) {
v.extend_from_slice(b"Test!");
}
let mut vec = Vec::new();
initialize(&mut vec);
assert_eq!(&vec, b"Test!");
let mut small_vec = SmallVec::<[u8; 8]>::new();
initialize(&mut small_vec);
assert_eq!(&small_vec as &[_], b"Test!");
Required methods
fn extend_from_slice(&mut self, other: &[T])
fn extend_from_slice(&mut self, other: &[T])
Extends a collection from a slice of its element type