Trait smallvectune::ExtendFromSlice[][src]

pub trait ExtendFromSlice<T> {
    fn extend_from_slice(&mut self, other: &[T]);

Trait to be implemented by a collection that can be extended from a slice


use smallvec::{ExtendFromSlice, SmallVec};

fn initialize<V: ExtendFromSlice<u8>>(v: &mut V) {

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

Extends a collection from a slice of its element type

Implementations on Foreign Types

impl<A> ExtendFromSlice<<A as Array>::Item> for SmallVec<A> where
    A: Array,
    <A as Array>::Item: Copy

impl<T> ExtendFromSlice<T> for Vec<T> where
    T: Clone