[−][src]Type Definition flatk::ChunkedN
type ChunkedN<S> = UniChunked<S, usize>;
Define aliases for common uniform chunked types.
Methods
impl<S: Default> ChunkedN<S>
[src]
pub fn with_stride(n: usize) -> Self
[src]
Create an empty UniChunked
collection that groups elements into n
sized chunks.
Example
use flatk::*; let mut s = ChunkedN::<Vec<_>>::with_stride(3); s.push(&[1,2,3][..]); let mut iter = s.iter(); assert_eq!(Some(&[1,2,3][..]), iter.next()); assert_eq!(None, iter.next());
impl<S: Set> ChunkedN<S>
[src]
pub fn from_flat_with_stride(data: S, n: usize) -> Self
[src]
Create a UniChunked
collection that groups the elements of the
original set into uniformly sized groups at compile time.
Example
use flatk::*; let s = ChunkedN::from_flat_with_stride(vec![1,2,3,4,5,6], 3); let mut iter = s.iter(); assert_eq!(Some(&[1,2,3][..]), iter.next()); assert_eq!(Some(&[4,5,6][..]), iter.next()); assert_eq!(None, iter.next());
impl<T> ChunkedN<Vec<T>>
[src]
impl<T> ChunkedN<Vec<T>>
[src]
impl<S> ChunkedN<S>
[src]
ⓘImportant traits for Chunks<S>pub fn iter<'a>(&'a self) -> Chunks<S::Type> where
S: View<'a>,
[src]
S: View<'a>,
ⓘImportant traits for Chunks<S>pub fn iter_mut<'a>(&'a mut self) -> Chunks<S::Type> where
S: ViewMut<'a>,
[src]
S: ViewMut<'a>,
Mutably iterate over Chunked
data.
Example
use flatk::*; let mut s = ChunkedN::from_flat_with_stride(vec![1,2,3,4,5,6], 3); s.view_mut().isolate(1).copy_from_slice(&[0; 3]); let mut iter = s.iter(); assert_eq!(Some(&[1,2,3][..]), iter.next()); assert_eq!(Some(&[0,0,0][..]), iter.next()); assert_eq!(None, iter.next());
Trait Implementations
impl<S> IntoIterator for ChunkedN<S> where
S: Set + IntoChunkIterator,
[src]
S: Set + IntoChunkIterator,
type Item = <S as IntoChunkIterator>::Item
The type of the elements being iterated over.
type IntoIter = <S as IntoChunkIterator>::IterType
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Convert a ChunkedN
collection into an iterator over grouped elements.
Example
use flatk::*; let mut s = ChunkedN::from_flat_with_stride(vec![1,2,3,4,5,6], 3); let mut iter = s.view().into_iter(); assert_eq!(Some(&[1,2,3][..]), iter.next()); assert_eq!(Some(&[4,5,6][..]), iter.next()); assert_eq!(None, iter.next());
impl<S: IntoParChunkIterator> IntoParallelIterator for ChunkedN<S>
[src]
type Item = <S as IntoParChunkIterator>::Item
The type of item that the parallel iterator will produce.
type Iter = <S as IntoParChunkIterator>::IterType
The parallel iterator type that will be created.
fn into_par_iter(self) -> Self::Iter
[src]
Convert a ChunkedN
collection into a parallel iterator over grouped elements.
impl<S: Set + SwapChunks> PermuteInPlace for ChunkedN<S>
[src]
This is a more general implementation of permute in place that is also used for slices.
fn permute_in_place(&mut self, permutation: &[usize], seen: &mut [bool])
[src]
Permute this collection according to the given permutation.
The given permutation must have length equal to this collection.
The slice seen
is provided to keep track of which elements have already been seen.
seen
is assumed to be initialized to false
and have length equal or
larger than this collection.
impl<'_, S> Push<&'_ [<S as Set>::Elem]> for ChunkedN<S> where
S: Set + Push<<S as Set>::Elem>,
<S as Set>::Elem: Clone,
[src]
S: Set + Push<<S as Set>::Elem>,
<S as Set>::Elem: Clone,
fn push(&mut self, element: &[<S as Set>::Elem])
[src]
Push a grouped element onto the ChunkedN
type.
Example
use flatk::*; let mut s = ChunkedN::from_flat_with_stride(vec![1,2,3], 3); s.push(&[4,5,6]); let mut iter = s.iter(); assert_eq!(Some(&[1,2,3][..]), iter.next()); assert_eq!(Some(&[4,5,6][..]), iter.next()); assert_eq!(None, iter.next());
impl<S: RemovePrefix> RemovePrefix for ChunkedN<S>
[src]
fn remove_prefix(&mut self, n: usize)
[src]
impl<S: Set> Set for ChunkedN<S>
[src]
An implementation of Set
for a UniChunked
collection of any type that
can be grouped into sub-elements whose size is determined at run-time.
type Elem = Vec<S::Elem>
Owned element of the set.
type Atom = S::Atom
The most basic element contained by this collection. If this collection contains other collections, this type should be different than Elem
. Read more
fn len(&self) -> usize
[src]
Compute the length of this UniChunked
collection as the number of
grouped elements in the set.
Example
use flatk::*; let s = ChunkedN::from_flat_with_stride(vec![0,1,2,3,4,5], 2); assert_eq!(s.len(), 3); let s = ChunkedN::from_flat_with_stride(vec![0,1,2,3,4,5], 3); assert_eq!(s.len(), 2);
fn is_empty(&self) -> bool
[src]
impl<S: SplitAt + Set> SplitAt for ChunkedN<S>
[src]
fn split_at(self, mid: usize) -> (Self, Self)
[src]
Split the current set into two distinct sets at the given index mid
.
Example
use flatk::*; let s = ChunkedN::from_flat_with_stride(vec![0,1,2,3], 2); let (l, r) = s.split_at(1); assert_eq!(l, ChunkedN::from_flat_with_stride(vec![0,1], 2)); assert_eq!(r, ChunkedN::from_flat_with_stride(vec![2,3], 2));
impl<S, M: Unsigned> SplitPrefix<M> for ChunkedN<S> where
S: SplitAt + Set,
[src]
S: SplitAt + Set,
impl<S: SwapChunks> SwapChunks for ChunkedN<S>
[src]
fn swap_chunks(&mut self, begin_a: usize, begin_b: usize, chunk_size: usize)
[src]
impl<S: Truncate> Truncate for ChunkedN<S>
[src]
impl<S, M> UniChunkable<M> for ChunkedN<S>
[src]
impl<'a, S> ViewIterator<'a> for ChunkedN<S> where
S: View<'a>,
<S as View<'a>>::Type: SplitAt + Set + Dummy,
[src]
S: View<'a>,
<S as View<'a>>::Type: SplitAt + Set + Dummy,
impl<'a, S> ViewMutIterator<'a> for ChunkedN<S> where
S: ViewMut<'a>,
<S as ViewMut<'a>>::Type: SplitAt + Set + Dummy,
[src]
S: ViewMut<'a>,
<S as ViewMut<'a>>::Type: SplitAt + Set + Dummy,