/// Copy all elements from the slice and append to the `ArrayVec`.
///
/// ```
/// use arrayvec::ArrayVec;
///
/// let mut vec: ArrayVec<usize, 10> = ArrayVec::new();
/// vec.push(1);
/// vec.try_extend_from_slice(&[2, 3]).unwrap();
/// assert_eq!(&vec[..], &[1, 2, 3]);
/// ```
///
/// # Errors
///
/// This method will return an error if the capacity left (see
/// [`remaining_capacity`]) is smaller then the length of the provided
/// slice.
///
/// [`remaining_capacity`]: #method.remaining_capacity
Copy all elements from the slice and append to the `ArrayVec`.


Copy all elements from the slice and append to the ` ArrayVec ` .
pub fn try_extend_from_slice(&mut self, other: &[T]) -> Result<(), CapacityError>
        where T: Copy,
    {
        if self.remaining_capacity() < other.len() {
            return Err(CapacityError::new(()));
        }
        let self_len = self.len();
        let other_len = other.len();
        unsafe {
            let dst = self.get_unchecked_ptr(self_len);
            ptr::copy_nonoverlapping(other.as_ptr(), dst, other_len);
            self.set_len(self_len + other_len);
        }
        Ok(())
    }
pub fn try_extend_from_slice ( & mut self , other : & [ T ] ) -> Result < ( ) , CapacityError > where T : Copy , { if self . remaining_capacity ( ) < other . len ( ) { return Err ( CapacityError :: new ( ( ) ) ) ; } let self_len = self . len ( ) ; let other_len = other . len ( ) ; unsafe { let dst = self . get_unchecked_ptr ( self_len ) ; ptr :: copy_nonoverlapping ( other . as_ptr ( ) , dst , other_len ) ; self . set_len ( self_len + other_len ) ; } Ok ( ( ) ) }
Copy all elements from the slice and append to the `ArrayVec`.
Copy all elements from the slice and append to the ` ArrayVec ` .
&mut self
other
&[T]
errors
This method will return an error if the capacity left (see
[`remaining_capacity`]) is smaller then the length of the provided
slice.

[`remaining_capacity`]: #method.remaining_capacity
This method will return an error if the capacity left ( see [ ` remaining_capacity ` ] ) is smaller then the length of the provided slice . [ ` remaining_capacity ` ] : #method . remaining_capacity