/// Extracts a slice of the given queue beginning at `slice_begin` and
/// containing at most `max` items.
Extracts a slice of the given queue beginning at `slice_begin` and
containing at most `max` items.
Extracts a slice of the given queue beginning at ` slice_begin ` and containing at most ` max ` items .
pub fn slice(&self, slice_begin: StreamIndex, max: Option<usize>) -> StreamIndexedQueue<T>
    where
        T: Clone,
    {
        assert!(
            slice_begin >= self.begin(),
            "Requested `slice_begin` ({}) before `self.begin()` ({})",
            slice_begin,
            self.begin()
        );
        assert!(
            slice_begin <= self.end(),
            "Requested `slice_begin` ({}) after `self.end()` ({})",
            slice_begin,
            self.end()
        );
        let skip = (slice_begin - self.begin()).get() as usize;
        let max = max.unwrap_or_else(|| self.len());
        StreamIndexedQueue {
            begin: slice_begin,
            queue: self
                .queue
                .iter()
                .skip(skip)
                .take(max)
                .map(T::clone)
                .collect::<VecDeque<_>>(),
        }
    }
pub fn slice ( & self , slice_begin : StreamIndex , max : Option < usize > ) -> StreamIndexedQueue < T > where T : Clone , { assert ! ( slice_begin self begin ( ) " " slice_begin self begin ( ) ) ; assert ! ( slice_begin self end ( ) " " slice_begin self end ( ) ) ; let skip = ( slice_begin - self . begin ( ) ) . get ( ) as usize ; let max = max . unwrap_or_else ( | | self . len ( ) ) ; StreamIndexedQueue { begin : slice_begin , queue : self . queue . iter ( ) . skip ( skip ) . take ( max ) . map ( T :: clone ) . collect :: < VecDeque < _ > > ( ) , } }
Extracts a slice of the given queue beginning at `slice_begin` and
containing at most `max` items.
Extracts a slice of the given queue beginning at ` slice_begin ` and containing at most ` max ` items .
&self
slice_begin
StreamIndex
max
Option<usize>