pub fn pop_slice(&mut self, elems: &mut [T]) -> Result<usize, PopSliceError> {
        let pop_fn = |left: &mut [T], right: &mut [T]| {
            let elems_len = elems.len();
            Ok((if elems_len < left.len() {
                elems.copy_from_slice(&left[0..elems_len]);
                elems_len
            } else {
                elems[0..left.len()].copy_from_slice(left);
                if elems_len < left.len() + right.len() {
                    elems[left.len()..elems_len]
                        .copy_from_slice(&right[0..(elems_len - left.len())]);
                    elems_len
                } else {
                    elems[left.len()..(left.len() + right.len())].copy_from_slice(right);
                    left.len() + right.len()
                }
            }, ()))
        };
        match unsafe { self.pop_access(pop_fn) } {
            Ok(res) => match res {
                Ok((n, ())) => {
                    Ok(n)
                },
                Err(()) => unreachable!(),
            },
            Err(e) => match e {
                PopAccessError::Empty => Err(PopSliceError::Empty),
                PopAccessError::BadLen => unreachable!(),
            }
        }
    }
/// Removes first elements from the ring buffer and writes them into a slice.
/// Elements should be [`Copy`](https://doc.rust-lang.org/std/marker/trait.Copy.html).
///
/// On success returns count of elements been removed from the ring buffer.
Removes first elements from the ring buffer and writes them into a slice.
Elements should be [`Copy`].

On success returns count of elements been removed from the ring buffer.
Removes first elements from the ring buffer and writes them into a slice . Elements should be [ ` Copy ` ] . On success returns count of elements been removed from the ring buffer .
pub fn pop_slice(&mut self, elems: &mut [T]) -> Result<usize, PopSliceError> {
        let pop_fn = |left: &mut [T], right: &mut [T]| {
            let elems_len = elems.len();
            Ok((if elems_len < left.len() {
                elems.copy_from_slice(&left[0..elems_len]);
                elems_len
            } else {
                elems[0..left.len()].copy_from_slice(left);
                if elems_len < left.len() + right.len() {
                    elems[left.len()..elems_len]
                        .copy_from_slice(&right[0..(elems_len - left.len())]);
                    elems_len
                } else {
                    elems[left.len()..(left.len() + right.len())].copy_from_slice(right);
                    left.len() + right.len()
                }
            }, ()))
        };
        match unsafe { self.pop_access(pop_fn) } {
            Ok(res) => match res {
                Ok((n, ())) => {
                    Ok(n)
                },
                Err(()) => unreachable!(),
            },
            Err(e) => match e {
                PopAccessError::Empty => Err(PopSliceError::Empty),
                PopAccessError::BadLen => unreachable!(),
            }
        }
    }
pub fn pop_slice ( & mut self , elems : & mut [ T ] ) -> Result < usize , PopSliceError > { let pop_fn = | left : & mut [ T ] , right : & mut [ T ] | { let elems_len = elems . len ( ) ; Ok ( ( if elems_len < left . len ( ) { elems . copy_from_slice ( & left [ 0 .. elems_len ] ) ; elems_len } else { elems [ 0 .. left . len ( ) ] . copy_from_slice ( left ) ; if elems_len < left . len ( ) + right . len ( ) { elems [ left . len ( ) .. elems_len ] . copy_from_slice ( & right [ 0 .. ( elems_len - left . len ( ) ) ] ) ; elems_len } else { elems [ left . len ( ) .. ( left . len ( ) + right . len ( ) ) ] . copy_from_slice ( right ) ; left . len ( ) + right . len ( ) } } , ( ) ) ) } ; match unsafe { self . pop_access ( pop_fn ) } { Ok ( res ) => match res { Ok ( ( n , ( ) ) ) => { Ok ( n ) } , Err ( ( ) ) => unreachable ! ( ) , } , Err ( e ) => match e { PopAccessError :: Empty => Err ( PopSliceError :: Empty ) , PopAccessError :: BadLen => unreachable ! ( ) , } } }
Removes first elements from the ring buffer and writes them into a slice.
Removes first elements from the ring buffer and writes them into a slice .
&mut self
elems
&mut [T]
&mut self
elems
&mut [T]