[−][src]Trait flatk::RemovePrefix
A helper trait used to help implement the Subset. This trait allows abstract collections to remove a number of elements from the beginning, which is what we need for subsets.
Required methods
fn remove_prefix(&mut self, n: usize)
Remove n
elements from the beginning.
Implementations on Foreign Types
impl<T> RemovePrefix for Range<T> where
T: From<usize>,
[src]
T: From<usize>,
fn remove_prefix(&mut self, n: usize)
[src]
impl<'_, T> RemovePrefix for &'_ [T]
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<'_, T> RemovePrefix for &'_ mut [T]
[src]
fn remove_prefix(&mut self, n: usize)
[src]
Remove a prefix of size n
from this mutable slice.
Example
use flatk::*; let mut v = vec![1,2,3,4,5]; let mut s = v.as_mut_slice(); s.remove_prefix(2); assert_eq!(&[3,4,5], s);
impl<S: RemovePrefix, T: RemovePrefix> RemovePrefix for (S, T)
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<T> RemovePrefix for Vec<T>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
Implementors
impl<O: RemovePrefix> RemovePrefix for Offsets<O>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<O: RemovePrefix> RemovePrefix for SortedChunks<O>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<S, I: RemovePrefix> RemovePrefix for Select<S, I>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<S: RemovePrefix> RemovePrefix for ChunkedN<S>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<S: RemovePrefix, N: Unsigned> RemovePrefix for UniChunked<S, U<N>>
[src]
Required for building Subset
s of UniChunked
types.
fn remove_prefix(&mut self, n: usize)
[src]
impl<S: RemovePrefix, O: RemovePrefix + AsRef<[usize]>> RemovePrefix for Chunked<S, O>
[src]
Required for subsets of chunked collections.
fn remove_prefix(&mut self, n: usize)
[src]
Remove a prefix of size n
from a chunked collection.
Example
use flatk::*; let mut s = Chunked::<Vec<usize>>::from_offsets(vec![0,1,4,6], vec![0,1,2,3,4,5]); s.remove_prefix(2); let mut iter = s.iter(); assert_eq!(Some(&[4,5][..]), iter.next()); assert_eq!(None, iter.next());
impl<S: RemovePrefix, T, I: RemovePrefix> RemovePrefix for Sparse<S, T, I>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<S: Set + RemovePrefix, I: RemovePrefix + AsRef<[usize]>> RemovePrefix for Subset<S, I>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
This function will panic if n
is larger than self.len()
.