Chunked

Struct Chunked 

Source
pub struct Chunked<S, O = Offsets> {
    pub chunks: O,
    pub data: S,
}
Expand description

A partitioning of the collection S into distinct chunks.

Fields§

§chunks: O

This can be either offsets of a uniform chunk size, if chunk size is specified at compile time.

§data: S

Implementations§

Source§

impl<'a, S, O> Chunked<S, O>
where S: View<'a>, O: View<'a>, O::Type: IntoParOffsetValuesAndSizes + GetOffset,

Source

pub fn par_iter( &'a self, ) -> ChunkedParIter<<<O as View<'a>>::Type as IntoParOffsetValuesAndSizes>::ParIter, <S as View<'a>>::Type>

Produce a parallel iterator over elements (borrowed slices) of a Chunked.

Source§

impl<'a, S, O> Chunked<S, O>

Source

pub fn par_iter_mut( &'a mut self, ) -> ChunkedParIter<<<O as View<'a>>::Type as IntoParOffsetValuesAndSizes>::ParIter, <S as ViewMut<'a>>::Type>

Produce a parallel iterator over elements (borrowed slices) of a Chunked.

Source§

impl<'a, S, T, I, O> Chunked<Sparse<S, T, I>, Offsets<O>>
where I: Dummy + AsIndexSliceMut, T: Dummy + Set + View<'a>, <T as View<'a>>::Type: Set + Clone + Dummy, S: Dummy + Set + ViewMut<'a>, <S as ViewMut<'a>>::Type: Set + SplitAt + Dummy + PermuteInPlace, O: Clone + AsRef<[usize]>,

Source

pub fn sort_chunks_by_index(&'a mut self)

Sort each sparse chunk by the source index.

§Example
use flatk::*;
let sparse = Sparse::from_dim(vec![0,2,1,2,0], 4, vec![1,2,3,4,5]);
let mut chunked = Chunked::from_sizes(vec![3,2], sparse);
chunked.sort_chunks_by_index();
assert_eq!(chunked.storage(), &[1,3,2,5,4]);
assert_eq!(chunked.data().indices(), &[0,1,2,0,2]);
Source§

impl<'a, S, T, I, O> Chunked<Sparse<S, T, I>, Offsets<O>>
where S: Storage + IntoOwned + Set + View<'a>, S::Storage: Set, <S as View<'a>>::Type: SplitAt + Dummy + Set, T: View<'a> + Set + Clone, <T as View<'a>>::Type: Set + Dummy + Clone, I: AsIndexSlice, O: Set + AsRef<[usize]>,

Source

pub fn compressed<E>( &'a self, combine: impl FnMut(&mut E::Owned, E), ) -> Chunked<Sparse<S::Owned, T>, Offsets>
where <S as View<'a>>::Type: IntoIterator<Item = E>, E: IntoOwned, S::Owned: Set<Elem = E::Owned> + Default + Reserve + Push<E::Owned>,

Combine elements in each sorted chunk with the same index using the given function.

Assuming that the chunks are sorted by index, this function will combine adjacent elements with the same index into one element.

§Example
use flatk::*;
let sparse = Sparse::from_dim(vec![0,2,1,1,2,0,2], 4, vec![1,2,3,4,5,6,7]);
let mut chunked = Chunked::from_sizes(vec![4,3], sparse);
chunked.sort_chunks_by_index();
let compressed = chunked.compressed(|a, b| *a += *b);
assert_eq!(compressed.view().offsets().into_inner(), &[0,3,5]);
assert_eq!(compressed.view().storage(), &[1,7,2,6,12]);
assert_eq!(compressed.view().data().indices(), &[0,1,2,0,2]);
Source§

impl<'a, S, T, I, O> Chunked<Sparse<S, T, I>, Offsets<O>>
where S: Storage + IntoOwned + Set + View<'a>, S::Storage: Set, <S as View<'a>>::Type: SplitAt + Dummy + Set, T: View<'a> + Set + Clone, <T as View<'a>>::Type: Set + Dummy + Clone, I: AsIndexSlice, O: Set + AsRef<[usize]>,

Source

pub fn pruned<E>( &'a self, combine: impl FnMut(&mut E::Owned, E), keep: impl FnMut(usize, usize, &E::Owned) -> bool, map: impl FnMut(usize, usize), ) -> Chunked<Sparse<S::Owned, T>, Offsets>
where <S as View<'a>>::Type: IntoIterator<Item = E>, E: IntoOwned, S::Owned: Set<Elem = E::Owned> + Default + Reserve + Push<E::Owned>,

Prune elements according to a given predicate and combine them in each sorted chunk with the same index.

Assuming that the chunks are sorted by index, this function will combine adjacent elements with the same index into one element.

This is a more general version of compressed that allows you to prune unwanted elements. In addition the combine and keep functions get an additional target index where each element will be written to.

§Examples

A simple example.

use flatk::*;
let sparse = Sparse::from_dim(vec![0,2,1,1,2,0,2], 4, vec![1.0, 2.0, 0.1, 0.01, 5.0, 0.001, 7.0]);
let mut chunked = Chunked::from_sizes(vec![4,3], sparse);
chunked.sort_chunks_by_index();
let pruned = chunked.pruned(|a, b| *a += *b, |_, _, &val| val > 0.01, |_,_| {});
assert_eq!(pruned.view().offsets().into_inner(), &[0,3,4]);
assert_eq!(pruned.view().storage(), &[1.0, 0.11, 2.0, 12.0]); // 0.001 is pruned.
assert_eq!(pruned.view().data().indices(), &[0,1,2,2]);

The following example extends on the previous example but shows how one may construct a mapping from original elements to the pruned output.

use flatk::*;
let indices = vec![0, 2, 1, 1, 2, 0, 2];
let num_indices = indices.len();
let sparse = Sparse::from_dim(indices, 4, vec![1.0, 2.0, 0.1, 0.01, 5.0, 0.001, 7.0]);
let mut chunked = Chunked::from_sizes(vec![4,3], sparse);
chunked.sort_chunks_by_index();
let mut mapping = vec![None; num_indices];
let pruned = chunked.pruned(|a, b| {
    *a += *b
}, |_, _, &val| {
    val > 0.01
}, |src, dst| mapping[src] = Some(dst));

// As before, the resulting structure is pruned.
assert_eq!(pruned.view().offsets().into_inner(), &[0,3,4]);
assert_eq!(pruned.view().storage(), &[1.0, 0.11, 2.0, 12.0]); // 0.001 is pruned.
assert_eq!(pruned.view().data().indices(), &[0,1,2,2]);
assert_eq!(mapping, vec![Some(0), Some(1), Some(1), Some(2), None, Some(3), Some(3)]);
Source§

impl<S, O> Chunked<S, O>

Source

pub fn data(&self) -> &S

Get a immutable reference to the underlying data.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6];
let s = Chunked::from_offsets(vec![0,3,4,6], v.clone());
assert_eq!(&v, s.data());
Source

pub fn data_mut(&mut self) -> &mut S

Get a mutable reference to the underlying data.

§Example
use flatk::*;
let mut v = vec![1,2,3,4,5,6];
let mut s = Chunked::from_offsets(vec![0,3,4,6], v.clone());
v[2] = 100;
s.data_mut()[2] = 100;
assert_eq!(&v, s.data());
Source§

impl<S: Set> Chunked<S>

Source

pub fn from_sizes(sizes: impl AsRef<[usize]>, data: S) -> Self

Construct a Chunked collection of elements from a set of sizes that determine the number of elements in each chunk. The sum of the sizes must be equal to the length of the given data.

§Panics

This function will panic if the sum of all given sizes is greater than data.len().

§Example
use flatk::*;
let s = Chunked::from_sizes(vec![3,1,2], vec![1,2,3,4,5,6]);
let mut iter = s.iter();
assert_eq!(vec![1,2,3], iter.next().unwrap().to_vec());
assert_eq!(vec![4], iter.next().unwrap().to_vec());
assert_eq!(vec![5,6], iter.next().unwrap().to_vec());
assert_eq!(None, iter.next());
Source§

impl<S: Set> Chunked<S, ClumpedOffsets>

Source

pub fn from_sizes_and_counts( sizes: impl AsRef<[usize]>, counts: impl AsRef<[usize]>, data: S, ) -> Self

Constructs a Clumped collection of elements from a set of sizes and counts

sizes and counts determine the number of elements in each chunk. The length of sizes must be equal to the the length of counts. Each element in sizes corresponds to chunk size, while the corresponding element in counts tells how many times this chunk size is repeated.

The dot product between sizes and counts must be equal to the length of the given data.

§Panics

This function will panic if sizes and counts have different lengths or if the dot product between sizes and counts is not equal to data.len().

§Example
use flatk::*;
let s = Clumped::from_sizes_and_counts(vec![3,2], vec![2,1], vec![1,2,3,4,5,6,7,8]);
let mut iter = s.iter();
assert_eq!(&[1, 2, 3][..], iter.next().unwrap());
assert_eq!(&[4, 5, 6][..], iter.next().unwrap());
assert_eq!(&[7, 8][..], iter.next().unwrap());
assert_eq!(None, iter.next());
Source§

impl<S: Set, O: AsRef<[usize]>> Chunked<S, Offsets<O>>

Source

pub fn from_offsets(offsets: O, data: S) -> Self

Construct a Chunked collection of elements given a collection of offsets into S. This is the most efficient constructor for creating variable sized chunks, however it is also the most error prone.

§Panics

The absolute value of offsets is not significant, however their relative quantities are. More specifically, if x is the first offset, then the last element of offsets must always be data.len() + x. This also implies that offsets cannot be empty. This function panics if any one of these invariants isn’t satisfied.

§Example
use flatk::*;
let s = Chunked::from_offsets(vec![0,3,4,6], vec![1,2,3,4,5,6]);
let mut iter = s.iter();
assert_eq!(vec![1,2,3], iter.next().unwrap().to_vec());
assert_eq!(vec![4], iter.next().unwrap().to_vec());
assert_eq!(vec![5,6], iter.next().unwrap().to_vec());
assert_eq!(None, iter.next());
Source§

impl<S: Set, O: AsRef<[usize]>> Chunked<S, ClumpedOffsets<O>>

Source

pub fn from_clumped_offsets(chunk_offsets: O, offsets: O, data: S) -> Self

Construct a Clumped collection of elements given a collection of “clumped” offsets into S. This is the most efficient constructor for creating Clumped types, however it is also the most error prone.

chunk_offsets, identify the offsets into a conceptually “chunked” version of S. offsets is a corresponding the collection of offsets into S itself.

In theory, these should specify the places where the chunk size (or stride) changes within S, however this is not always necessary.

§Panics

The absolute value of offsets (this applies to both offsets as well as chunk_offsets) is not significant, however their relative quantities are. More specifically, for offsets, if x is the first offset, then the last element of offsets must always be data.len() + x. For chunk_offsets the same holds but data is substituted by the conceptual collection of chunks stored in data. This also implies that offsets cannot be empty. This function panics if any one of these invariants isn’t satisfied.

This function will also panic if offsets and chunk_offsets have different lengths.

Although the validity of offsets is easily checked, the same is not true for chunk_offsets, since the implied stride must divide into the size of each clump, and checking this at run time is expensive. As such a malformed Clumped may cause panics somewhere down the line. For ensuring a valid construction, use the Self::from_sizes_and_counts constructor.

§Example
use flatk::*;
let v = vec![1,2, 3,4, 5,6, 7,8,9];

// The following splits v intos 3 pairs and a triplet.
let s = Clumped::from_clumped_offsets(vec![0,3,4], vec![0,6,9], v);
let mut iter = s.iter();
assert_eq!(&[1,2][..], iter.next().unwrap());
assert_eq!(&[3,4][..], iter.next().unwrap());
assert_eq!(&[5,6][..], iter.next().unwrap());
assert_eq!(&[7,8,9][..], iter.next().unwrap());
assert_eq!(None, iter.next());
Source§

impl<S: Set, O> Chunked<S, O>

Source

pub fn into_inner(self) -> (O, S)

Convert this Chunked into its inner representation, which consists of a collection of offsets (first output) along with the underlying data storage type (second output).

§Example
use flatk::*;
let data = vec![1,2,3,4,5,6];
let offsets = vec![0,3,4,6];
let s = Chunked::from_offsets(offsets.clone(), data.clone());
assert_eq!(s.into_inner(), (Offsets::new(offsets), data));
Source

pub fn as_inner_mut(&mut self) -> (&mut O, &mut S)

This function mutably borrows the inner structure of the chunked collection.

Source§

impl<S, O> Chunked<S, O>

Source

pub fn offsets(&self) -> &O

Source§

impl<S, O> Chunked<S, O>
where O: GetOffset,

Source

pub fn offset(&self, index: usize) -> usize

Return the offset into data of the element at the given index. This function returns the total length of data if index is equal to self.len().

§Panics

This function panics if index is larger than self.len().

§Example
use flatk::*;
let s = Chunked::from_offsets(vec![2,5,6,8], vec![1,2,3,4,5,6]);
assert_eq!(0, s.offset(0));
assert_eq!(3, s.offset(1));
assert_eq!(4, s.offset(2));
Source

pub fn offset_value(&self, index: usize) -> usize

Return the raw offset value of the element at the given index.

§Panics

This function panics if index is larger than self.len().

§Example
use flatk::*;
let s = Chunked::from_offsets(vec![2,5,6,8], vec![1,2,3,4,5,6]);
assert_eq!(2, s.offset_value(0));
assert_eq!(5, s.offset_value(1));
assert_eq!(6, s.offset_value(2));
Source

pub fn chunk_len(&self, chunk_index: usize) -> usize

Get the length of the chunk at the given index. This is equivalent to self.view().at(chunk_index).len().

Source§

impl<S, O> Chunked<S, Offsets<O>>
where O: AsRef<[usize]> + AsMut<[usize]>,

Source

pub fn transfer_forward(&mut self, chunk_index: usize, num_elements: usize)

Move a number of elements from a chunk at the given index to the following chunk. If the last chunk is selected, then the transferred elements are effectively removed.

This operation is efficient and only performs one write on a single element in an array of usize.

§Example
use flatk::*;
let v = vec![1,2,3,4,5];
let mut c = Chunked::from_sizes(vec![3,2], v);
let mut c_iter = c.iter();
assert_eq!(Some(&[1,2,3][..]), c_iter.next());
assert_eq!(Some(&[4,5][..]), c_iter.next());
assert_eq!(None, c_iter.next());

// Transfer 2 elements from the first chunk to the next.
c.transfer_forward(0, 2);
let mut c_iter = c.iter();
assert_eq!(Some(&[1][..]), c_iter.next());
assert_eq!(Some(&[2,3,4,5][..]), c_iter.next());
assert_eq!(None, c_iter.next());
Source

pub fn transfer_forward_all_but( &mut self, chunk_index: usize, num_elements_to_keep: usize, )

Like transfer_forward but specify the number of elements to keep instead of the number of elements to transfer in the chunk at chunk_index.

Source§

impl<S, O> Chunked<S, Offsets<O>>
where O: AsRef<[usize]> + AsMut<[usize]>, S: RemovePrefix,

Source

pub fn transfer_backward(&mut self, chunk_index: usize, num_elements: usize)

Move a number of elements from a chunk at the given index to the previous chunk.

If the first chunk is selected, then the transferred elements are explicitly removed, which may cause reallocation if the underlying storage type manages memory.

This operation is efficient and only performs one write on a single element in an array of usize, unless a reallocation is triggered.

§Example
use flatk::*;
let v = vec![1,2,3,4,5];
let mut c = Chunked::from_sizes(vec![3,2], v);
let mut c_iter = c.iter();
assert_eq!(Some(&[1,2,3][..]), c_iter.next());
assert_eq!(Some(&[4,5][..]), c_iter.next());
assert_eq!(None, c_iter.next());

// Transfer 1 element from the second chunk to the previous.
c.transfer_backward(1, 1);
let mut c_iter = c.iter();
assert_eq!(Some(&[1,2,3,4][..]), c_iter.next());
assert_eq!(Some(&[5][..]), c_iter.next());
assert_eq!(None, c_iter.next());
Source§

impl<S: Default, O: Default> Chunked<S, O>

Source

pub fn new() -> Self

Construct an empty Chunked type.

Source§

impl<S> Chunked<S>
where S: Set + Default + ExtendFromSlice<Item = <S as Set>::Elem>,

Source

pub fn from_nested_vec(nested_data: Vec<Vec<<S as Set>::Elem>>) -> Self

Construct a Chunked Vec from a nested Vec.

§Example
use flatk::*;
let s = Chunked::<Vec<_>>::from_nested_vec(vec![vec![1,2,3],vec![4],vec![5,6]]);
let mut iter = s.iter();
assert_eq!(vec![1,2,3], iter.next().unwrap().to_vec());
assert_eq!(vec![4], iter.next().unwrap().to_vec());
assert_eq!(vec![5,6], iter.next().unwrap().to_vec());
assert_eq!(None, iter.next());
Source§

impl<S, O> Chunked<S, O>
where S: Truncate + Set, O: GetOffset,

Source

pub fn trim_data(&mut self) -> usize

Remove any unused data past the last offset. Return the number of elements removed.

§Example
use flatk::*;
let mut s = Chunked::from_sizes(vec![1,3,2], vec![1,2,3,4,5,6]);
assert_eq!(3, s.len());

// Transferring the last two elements past the indexed stack.
// This creates a zero sized chunk at the end.
s.transfer_forward(2, 2);
assert_eq!(6, s.data().len());
assert_eq!(3, s.len());

s.trim_data(); // Remove unindexed elements.
assert_eq!(4, s.data().len());
Source§

impl<S, O> Chunked<S, O>
where S: Truncate + Set, O: AsRef<[usize]> + GetOffset + Truncate,

Source

pub fn trim(&mut self) -> usize

Remove any empty chunks at the end of the collection and any unindexed data past the last offset. Return the number of chunks removed.

§Example
use flatk::*;
let mut s = Chunked::from_sizes(vec![1,3,2], vec![1,2,3,4,5,6]);
assert_eq!(3, s.len());

// Transferring the last two elements past the indexed stack.
// This creates an empty chunk at the end.
s.transfer_forward(2, 2);
assert_eq!(6, s.data().len());
assert_eq!(3, s.len());

s.trim(); // Remove unindexed elements.
assert_eq!(4, s.data().len());
Source§

impl<S, O> Chunked<S, O>
where S: Set + ExtendFromSlice<Item = <S as Set>::Elem>, O: Push<usize>,

Source

pub fn push_slice(&mut self, element: &[<S as Set>::Elem])

Push a slice of elements onto this Chunked. This can be more efficient than pushing from an iterator.

§Example
use flatk::*;
let mut s = Chunked::from_offsets(vec![0,3,5], vec![1,2,3,4,5]);
assert_eq!(2, s.len());
s.push_slice(&[1,2]);
assert_eq!(3, s.len());
Source§

impl<S, O> Chunked<S, O>
where S: Set, O: Push<usize>,

Source

pub fn push_iter<I: IntoIterator>(&mut self, iter: I)
where S: Extend<I::Item>,

Push a chunk using an iterator over chunk elements.

§Example
use flatk::*;
let mut s = Chunked::from_offsets(vec![0,3,5], vec![1,2,3,4,5]);
assert_eq!(2, s.len());
s.push_iter(std::iter::repeat(100).take(4));
assert_eq!(3, s.len());
assert_eq!(&[100; 4][..], s.view().at(2));
Source§

impl<S, O> Chunked<S, Offsets<O>>
where S: Set + Extend<<S as Set>::Elem>, O: AsMut<[usize]>,

Source

pub fn extend_last<I: IntoIterator<Item = <S as Set>::Elem>>(&mut self, iter: I)

Extend the last chunk with the given iterator.

§Example
use flatk::*;
let mut s = Chunked::from_offsets(vec![0,3,5], vec![1,2,3,4,5]);
assert_eq!(2, s.len());
s.extend_last(std::iter::repeat(100).take(2));
assert_eq!(2, s.len());
assert_eq!(&[4, 5, 100, 100][..], s.view().at(1));
Source§

impl<'a, S, O> Chunked<S, O>
where S: View<'a>, O: View<'a>, O::Type: IntoOffsetValuesAndSizes + GetOffset,

Source

pub fn iter( &'a self, ) -> ChunkedIter<<<O as View<'a>>::Type as IntoOffsetValuesAndSizes>::Iter, <S as View<'a>>::Type>

Produce an iterator over elements (borrowed slices) of a Chunked.

§Examples

The following simple example demonstrates how to iterate over a Chunked of integers stored in a flat Vec.

use flatk::*;
let s = Chunked::from_offsets(vec![0,3,4,6], vec![1,2,3,4,5,6]);
let mut iter = s.iter();
let mut e0_iter = iter.next().unwrap().iter();
assert_eq!(Some(&1), e0_iter.next());
assert_eq!(Some(&2), e0_iter.next());
assert_eq!(Some(&3), e0_iter.next());
assert_eq!(None, e0_iter.next());
assert_eq!(Some(&[4][..]), iter.next());
assert_eq!(Some(&[5,6][..]), iter.next());
assert_eq!(None, iter.next());

Nested Chunkeds can also be used to create more complex data organization:

use flatk::*;
let s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], vec![1,2,3,4,5,6,7,8,9,10,11]);
let s1 = Chunked::from_offsets(vec![0,1,4,5], s0);
let mut iter1 = s1.iter();
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[1,2,3][..]), iter0.next());
assert_eq!(None, iter0.next());
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[4][..]), iter0.next());
assert_eq!(Some(&[5,6][..]), iter0.next());
assert_eq!(Some(&[7,8,9][..]), iter0.next());
assert_eq!(None, iter0.next());
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[10,11][..]), iter0.next());
assert_eq!(None, iter0.next());
Source§

impl<'a, S, O> Chunked<S, O>
where S: ViewMut<'a>, O: View<'a>, O::Type: IntoOffsetValuesAndSizes + GetOffset,

Source

pub fn iter_mut( &'a mut self, ) -> ChunkedIter<<<O as View<'a>>::Type as IntoOffsetValuesAndSizes>::Iter, <S as ViewMut<'a>>::Type>

Produce a mutable iterator over elements (borrowed slices) of a Chunked.

§Example
use flatk::*;
let mut s = Chunked::from_offsets(vec![0,3,4,6], vec![1,2,3,4,5,6]);
for i in s.view_mut().iter_mut() {
    for j in i.iter_mut() {
        *j += 1;
    }
}
let mut iter = s.iter();
assert_eq!(vec![2,3,4], iter.next().unwrap().to_vec());
assert_eq!(vec![5], iter.next().unwrap().to_vec());
assert_eq!(vec![6,7], iter.next().unwrap().to_vec());
assert_eq!(None, iter.next());

Nested Chunkeds can also be used to create more complex data organization:

use flatk::*;
let mut s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], vec![0,1,2,3,4,5,6,7,8,9,10]);
let mut s1 = Chunked::from_offsets(vec![0,1,4,5], s0);
for mut v0 in s1.view_mut().iter_mut() {
    for i in v0.iter_mut() {
        for j in i.iter_mut() {
            *j += 1;
        }
    }
}
let v1 = s1.view();
let mut iter1 = v1.iter();
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[1,2,3][..]), iter0.next());
assert_eq!(None, iter0.next());
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[4][..]), iter0.next());
assert_eq!(Some(&[5,6][..]), iter0.next());
assert_eq!(Some(&[7,8,9][..]), iter0.next());
assert_eq!(None, iter0.next());
let v0 = iter1.next().unwrap();
let mut iter0 = v0.iter();
assert_eq!(Some(&[10,11][..]), iter0.next());
assert_eq!(None, iter0.next());

Trait Implementations§

Source§

impl<'a, S, O> AtomIterator<'a> for Chunked<S, O>
where S: AtomIterator<'a>,

Source§

type Item = <S as AtomIterator<'a>>::Item

Source§

type Iter = <S as AtomIterator<'a>>::Iter

Source§

fn atom_iter(&'a self) -> Self::Iter

Source§

impl<'a, S, O> AtomMutIterator<'a> for Chunked<S, O>
where S: AtomMutIterator<'a>,

Source§

type Item = <S as AtomMutIterator<'a>>::Item

Source§

type Iter = <S as AtomMutIterator<'a>>::Iter

Source§

fn atom_mut_iter(&'a mut self) -> Self::Iter

Source§

impl<S: Clear> Clear for Chunked<S>

Source§

fn clear(&mut self)

Remove all elements from the current set without necessarily deallocating the space previously used.
Source§

impl<S: Clone, O: Clone> Clone for Chunked<S, O>

Source§

fn clone(&self) -> Chunked<S, O>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, S: CloneWithStorage<T>, O: Clone> CloneWithStorage<T> for Chunked<S, O>

Source§

type CloneType = Chunked<<S as CloneWithStorage<T>>::CloneType, O>

Source§

fn clone_with_storage(&self, storage: T) -> Self::CloneType

Source§

impl<S: Debug, O: Debug> Debug for Chunked<S, O>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Default, O: Default> Default for Chunked<S, O>

Source§

fn default() -> Self

Construct an empty Chunked.

Source§

impl<S: Dummy, O: Dummy> Dummy for Chunked<S, O>

Source§

unsafe fn dummy() -> Self

Constructs a potentially invalid instance of a type. Read more
Source§

impl<S, O: AsRef<[usize]> + Set> From<Chunked<S, ClumpedOffsets<O>>> for Chunked<S>

Source§

fn from(clumped: Clumped<S, O>) -> Chunked<S>

Converts to this type from the input type.
Source§

impl<S, O: AsRef<[usize]> + Set> From<Chunked<S, Offsets<O>>> for Clumped<S>

Source§

fn from(chunked: Chunked<S, Offsets<O>>) -> Clumped<S>

Converts to this type from the input type.
Source§

impl<'a, S, O> FromIterator<&'a [<S as Set>::Elem]> for Chunked<S, O>
where S: Set + ExtendFromSlice<Item = <S as Set>::Elem> + Default, <S as Set>::Elem: 'a, O: Default + Push<usize>,

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = &'a [<S as Set>::Elem]>,

Construct a Chunked collection from an iterator over immutable slices.

§Example
use flatk::*;
let v = [&[1,2,3][..], &[4][..], &[5,6][..]];
let s: Chunked::<Vec<_>> = v.iter().cloned().collect();
let mut iter = s.iter();
assert_eq!(Some(&[1,2,3][..]), iter.next());
assert_eq!(Some(&[4][..]), iter.next());
assert_eq!(Some(&[5,6][..]), iter.next());
assert_eq!(None, iter.next());
Source§

impl<S> FromIterator<Vec<<S as Set>::Elem>> for Chunked<S>
where S: Set + Default + ExtendFromSlice<Item = <S as Set>::Elem>,

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = Vec<<S as Set>::Elem>>,

Construct a Chunked from an iterator over Vec types.

§Example
use flatk::*;
use std::iter::FromIterator;
let s = Chunked::<Vec<_>>::from_iter(vec![vec![1,2,3],vec![4],vec![5,6]].into_iter());
let mut iter = s.iter();
assert_eq!(vec![1,2,3], iter.next().unwrap().to_vec());
assert_eq!(vec![4], iter.next().unwrap().to_vec());
assert_eq!(vec![5,6], iter.next().unwrap().to_vec());
assert_eq!(None, iter.next());
Source§

impl<'a, S, O> GetIndex<'a, Chunked<S, O>> for &usize
where S: Set + View<'a> + Get<'a, Range<usize>, Output = <S as View<'a>>::Type>, O: IndexRange,

Source§

fn get(self, chunked: &Chunked<S, O>) -> Option<Self::Output>

Get an element of the given Chunked collection.

§Example
use flatk::*;
let v = vec![0, 1, 4, 6];
let data = (1..=6).collect::<Vec<_>>();
let s = Chunked::from_offsets(v.as_slice(), data.view());
assert_eq!(Some(&[1][..]), s.get(&0));
assert_eq!(Some(&[2,3,4][..]), s.get(&1));
assert_eq!(Some(&[5,6][..]), s.get(&2));
Source§

type Output = <S as Get<'a, Range<usize>>>::Output

Source§

unsafe fn at_unchecked(self, set: &S) -> Self::Output
where Self: Sized,

Gets the value in the set at this index. Read more
Source§

impl<'a, S, O> GetIndex<'a, Chunked<S, O>> for Range<usize>
where S: Set + View<'a> + Get<'a, Range<usize>, Output = <S as View<'a>>::Type>, O: IndexRange + Get<'a, Range<usize>>,

Source§

fn get(self, chunked: &Chunked<S, O>) -> Option<Self::Output>

Get a [begin..end) subview of the given Chunked collection.

§Example
use flatk::*;
let data = (1..=6).collect::<Vec<_>>();
let offsets = vec![1, 2, 5, 7]; // Offsets don't have to start at 0
let s = Chunked::from_offsets(offsets.as_slice(), data.view());
let v = s.get(1..3).unwrap();
assert_eq!(Some(&[2,3,4][..]), v.get(0));
assert_eq!(Some(&[5,6][..]), v.get(1));
Source§

type Output = Chunked<<S as Get<'a, Range<usize>>>::Output, <O as Get<'a, Range<usize>>>::Output>

Source§

unsafe fn at_unchecked(self, set: &S) -> Self::Output
where Self: Sized,

Gets the value in the set at this index. Read more
Source§

impl<'a, S, O> GetIndex<'a, Chunked<S, O>> for usize
where S: Set + View<'a> + Get<'a, Range<usize>, Output = <S as View<'a>>::Type>, O: IndexRange,

Source§

fn get(self, chunked: &Chunked<S, O>) -> Option<Self::Output>

Get an element of the given Chunked collection.

§Example
use flatk::*;
let v = vec![0, 1, 4, 6];
let data = (1..=6).collect::<Vec<_>>();
let s = Chunked::from_offsets(v.as_slice(), data.view());
assert_eq!(Some(&[1][..]), s.get(0));
assert_eq!(Some(&[2,3,4][..]), s.get(1));
assert_eq!(Some(&[5,6][..]), s.get(2));
Source§

type Output = <S as Get<'a, Range<usize>>>::Output

Source§

unsafe fn at_unchecked(self, set: &S) -> Self::Output
where Self: Sized,

Gets the value in the set at this index. Read more
Source§

impl<T, O> Index<usize> for Chunked<&[T], O>
where O: Index<usize, Output = usize>,

Source§

fn index(&self, idx: usize) -> &Self::Output

Immutably index the Chunked borrowed slice by usize.

Note that this works for chunked collections that are themselves not chunked, since the item at the index of a doubly chunked collection is itself chunked, which cannot be represented by a single borrow. For more complex indexing use the get method provided by the Get trait.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s = Chunked::from_offsets(vec![0,3,4,6,9,11], v.as_slice());
assert_eq!(&[5,6], &s[2]);
Source§

type Output = <[T] as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

impl<T, O> Index<usize> for Chunked<&mut [T], O>
where O: Index<usize, Output = usize>,

Source§

fn index(&self, idx: usize) -> &Self::Output

Immutably index the Chunked mutably borrowed slice by usize.

Note that this works for chunked collections that are themselves not chunked, since the item at the index of a doubly chunked collection is itself chunked, which cannot be represented by a single borrow. For more complex indexing use the get method provided by the Get trait.

§Example
use flatk::*;
let mut v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s = Chunked::from_offsets(vec![0,3,4,6,9,11], v.as_mut_slice());
assert_eq!(&[5,6], &s[2]);
Source§

type Output = <[T] as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

impl<T, O> Index<usize> for Chunked<Vec<T>, O>
where O: Index<usize, Output = usize>,

Source§

fn index(&self, idx: usize) -> &Self::Output

Get reference to a chunk at the given index.

Note that this works for Chunked collections that are themselves NOT Chunked, since a chunk of a doubly Chunked collection is itself Chunked, which cannot be represented by a single borrow. For more complex indexing use the get method provided by the Get trait.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
assert_eq!(2, (&s[2]).len());
assert_eq!(&[5,6], &s[2]);
Source§

type Output = <[T] as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

impl<T, O> IndexMut<usize> for Chunked<&mut [T], O>
where O: Index<usize, Output = usize>,

Source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

Mutably index the Chunked mutably borrowed slice by usize.

Note that this works for chunked collections that are themselves not chunked, since the item at the index of a doubly chunked collection is itself chunked, which cannot be represented by a single borrow. For more complex indexing use the get method provided by the Get trait.

§Example
use flatk::*;
let mut v = vec![1,2,3,4,0,0,7,8,9,10,11];
let mut s = Chunked::from_offsets(vec![0,3,4,6,9,11], v.as_mut_slice());
s[2].copy_from_slice(&[5,6]);
assert_eq!(vec![1,2,3,4,5,6,7,8,9,10,11], v);
Source§

impl<T, O> IndexMut<usize> for Chunked<Vec<T>, O>
where O: Index<usize, Output = usize>,

Source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

Mutably index the Chunked Vec by usize.

Note that this works for chunked collections that are themselves not chunked, since the item at the index of a doubly chunked collection is itself chunked, which cannot be represented by a single borrow. For more complex indexing use the get method provided by the Get trait.

§Example
use flatk::*;
let mut v = vec![1,2,3,4,0,0,7,8,9,10,11];
let mut s = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
s[2].copy_from_slice(&[5,6]);
assert_eq!(vec![1,2,3,4,5,6,7,8,9,10,11], s.into_storage());
Source§

impl<S> IntoIterator for Chunked<S>
where S: SplitOff + Set,

Source§

type Item = S

The type of the elements being iterated over.
Source§

type IntoIter = VarIntoIter<S>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, S, O> IntoIterator for Chunked<S, O>

Source§

type Item = S

The type of the elements being iterated over.
Source§

type IntoIter = ChunkedIter<<O as IntoOffsetValuesAndSizes>::Iter, S>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<S, O> IntoOwned for Chunked<S, O>
where S: IntoOwned, O: IntoOwned,

Source§

type Owned = Chunked<<S as IntoOwned>::Owned, <O as IntoOwned>::Owned>

Source§

fn into_owned(self) -> Self::Owned

Source§

fn clone_into(self, target: &mut Self::Owned)

Source§

impl<S, O> IntoOwnedData for Chunked<S, O>
where S: IntoOwnedData,

Source§

type OwnedData = Chunked<<S as IntoOwnedData>::OwnedData, O>

Source§

fn into_owned_data(self) -> Self::OwnedData

Source§

fn clone_into(self, target: &mut Self::OwnedData)

Source§

impl<S, O> IntoParallelIterator for Chunked<S, O>

Source§

type Item = S

The type of item that the parallel iterator will produce.
Source§

type Iter = ChunkedParIter<<O as IntoParOffsetValuesAndSizes>::ParIter, S>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<S: IntoStorage, O> IntoStorage for Chunked<S, O>

Source§

fn into_storage(self) -> Self::StorageType

Strip all organizational information from this set, returning the underlying storage type.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
let s1 = Chunked::from_offsets(vec![0,1,4,5], s0.clone());
assert_eq!(s1.into_storage(), v);
assert_eq!(s0.into_storage(), v);
Source§

type StorageType = <S as IntoStorage>::StorageType

Source§

impl<S, O> IsolateIndex<Chunked<S, O>> for Range<usize>

Source§

fn try_isolate(self, chunked: Chunked<S, O>) -> Option<Self::Output>

Isolate a [begin..end) range of the given Chunked collection.

Source§

type Output = Chunked<<S as Isolate<Range<usize>>>::Output, <O as Isolate<Range<usize>>>::Output>

Source§

unsafe fn isolate_unchecked(self, chunked: Chunked<S, O>) -> Self::Output

Attempts to isolate a value in the given set at this index. Read more
Source§

impl<S, O> IsolateIndex<Chunked<S, O>> for usize
where S: Set + Isolate<Range<usize>>, O: IndexRange,

Source§

fn try_isolate(self, chunked: Chunked<S, O>) -> Option<Self::Output>

Isolate a single chunk of the given Chunked collection.

Source§

type Output = <S as Isolate<Range<usize>>>::Output

Source§

unsafe fn isolate_unchecked(self, chunked: Chunked<S, O>) -> Self::Output

Attempts to isolate a value in the given set at this index. Read more
Source§

impl<S: MapStorage<Out>, O, Out> MapStorage<Out> for Chunked<S, O>

Source§

fn map_storage<F: FnOnce(Self::Input) -> Out>(self, f: F) -> Self::Output

Map the underlying storage type.

Source§

type Input = <S as MapStorage<Out>>::Input

Source§

type Output = Chunked<<S as MapStorage<Out>>::Output, O>

Source§

impl<S: PartialEq, O: PartialEq> PartialEq for Chunked<S, O>

Source§

fn eq(&self, other: &Chunked<S, O>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S, O, L> Push<L> for Chunked<S, O>
where S: Set + ExtendFromSlice<Item = <S as Set>::Elem>, L: AsRef<[<S as Set>::Elem]>, O: Push<usize>,

Source§

fn push(&mut self, element: L)

Push a slice of elements onto this Chunked.

§Examples
use flatk::*;
let mut s = Chunked::<Vec<usize>>::from_offsets(vec![0,1,4], vec![0,1,2,3]);
s.push(vec![4,5]);
let v1 = s.view();
let mut view1_iter = v1.into_iter();
assert_eq!(Some(&[0][..]), view1_iter.next());
assert_eq!(Some(&[1,2,3][..]), view1_iter.next());
assert_eq!(Some(&[4,5][..]), view1_iter.next());
assert_eq!(None, view1_iter.next());
use flatk::*;
let mut s = Chunked::from_offsets(vec![0,3,5], vec![1,2,3,4,5]);
assert_eq!(2, s.len());
s.push(&[1,2]);
assert_eq!(3, s.len());
Source§

impl<S: RemovePrefix, O: RemovePrefix + AsRef<[usize]>> RemovePrefix for Chunked<S, O>

Required for subsets of chunked collections.

Source§

fn remove_prefix(&mut self, n: usize)

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());
Source§

impl<S: Reserve, O: Reserve> Reserve for Chunked<S, O>

Source§

fn reserve_with_storage(&mut self, n: usize, storage_n: usize)

Source§

fn reserve(&mut self, n: usize)

Source§

impl<S, O> Set for Chunked<S, O>
where S: Set, O: GetOffset,

Source§

fn len(&self) -> usize

Get the number of elements in a Chunked.

§Example
use flatk::*;
let s = Chunked::from_offsets(vec![0,3,4,6], vec![1,2,3,4,5,6]);
assert_eq!(3, s.len());
Source§

type Elem = Vec<<S as Set>::Elem>

Owned element of the set.
Source§

type Atom = <S as Set>::Atom

The most basic element contained by this collection. If this collection contains other collections, this type should be different than Elem.
Source§

fn is_empty(&self) -> bool

Source§

impl<S, O> SplitAt for Chunked<S, O>
where S: SplitAt + Set, O: SplitOffsetsAt,

Source§

fn split_at(self, mid: usize) -> (Self, Self)

Split self into two sets at the given midpoint. This function is analogous to <[T]>::split_at.
Source§

impl<S, O> SplitFirst for Chunked<S, O>

Source§

type First = S

Source§

fn split_first(self) -> Option<(Self::First, Self)>

Source§

unsafe fn split_first_unchecked(self) -> (Self::First, Self)

Split off the first element without checking if one exists. Read more
Source§

impl<S: SplitOff + Set> SplitOff for Chunked<S>

Source§

fn split_off(&mut self, mid: usize) -> Self

Split self into two sets at the given midpoint. This function is analogous to Vec::split_off. self contains elements [0, mid), and The returned Self contains elements [mid, len).
Source§

impl<S, O, N> SplitPrefix<N> for Chunked<S, O>

Source§

type Prefix = Chunked<S, O>

Source§

fn split_prefix(self) -> Option<(Self::Prefix, Self)>

Split N items from the beginning of the collection. Read more
Source§

impl<S: Storage, O> Storage for Chunked<S, O>

Source§

fn storage(&self) -> &Self::Storage

Return an immutable reference to the underlying storage type.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
let s1 = Chunked::from_offsets(vec![0,1,4,5], s0.clone());
assert_eq!(s1.storage(), &v);
assert_eq!(s0.storage(), &v);
Source§

type Storage = <S as Storage>::Storage

Source§

impl<S: StorageInto<T>, O, T> StorageInto<T> for Chunked<S, O>

Pass through the conversion for structure type Chunked.

Source§

type Output = Chunked<<S as StorageInto<T>>::Output, O>

Source§

fn storage_into(self) -> Self::Output

Source§

impl<S: StorageMut, O> StorageMut for Chunked<S, O>

Source§

fn storage_mut(&mut self) -> &mut Self::Storage

Return a mutable reference to the underlying storage type.

§Example
use flatk::*;
let mut v = vec![1,2,3,4,5,6,7,8,9,10,11];
let mut s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
let mut s1 = Chunked::from_offsets(vec![0,1,4,5], s0.clone());
assert_eq!(s1.storage_mut(), &mut v);
assert_eq!(s0.storage_mut(), &mut v);
Source§

impl<'a, S: StorageView<'a>, O> StorageView<'a> for Chunked<S, O>

Source§

fn storage_view(&'a self) -> Self::StorageView

Return a view to the underlying storage type.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6,7,8,9,10,11];
let s0 = Chunked::from_offsets(vec![0,3,4,6,9,11], v.clone());
let s1 = Chunked::from_offsets(vec![0,1,4,5], s0.clone());
assert_eq!(s1.storage_view(), v.as_slice());
assert_eq!(s0.storage_view(), v.as_slice());
Source§

type StorageView = <S as StorageView<'a>>::StorageView

Source§

impl<S: Truncate, O> Truncate for Chunked<S, O>
where O: GetOffset,

Source§

fn truncate(&mut self, new_len: usize)

Source§

impl<S, I, N> UniChunkable<N> for Chunked<S, I>

Source§

type Chunk = Chunked<S, I>

Source§

impl<'a, S, O> View<'a> for Chunked<S, O>
where S: View<'a>, O: View<'a>,

Source§

fn view(&'a self) -> Self::Type

Create a contiguous immutable (shareable) view into this set.

§Example
use flatk::*;
let s = Chunked::<Vec<usize>>::from_offsets(vec![0,1,4,6], vec![0,1,2,3,4,5]);
let v1 = s.view();
let v2 = v1.clone();
let mut view1_iter = v1.clone().into_iter();
assert_eq!(Some(&[0][..]), view1_iter.next());
assert_eq!(Some(&[1,2,3][..]), view1_iter.next());
assert_eq!(Some(&[4,5][..]), view1_iter.next());
assert_eq!(None, view1_iter.next());
for (a,b) in v1.into_iter().zip(v2.into_iter()) {
    assert_eq!(a,b);
}
Source§

type Type = Chunked<<S as View<'a>>::Type, <O as View<'a>>::Type>

Source§

impl<'a, S, O> ViewIterator<'a> for Chunked<S, O>
where S: View<'a>, O: View<'a, Type = Offsets<&'a [usize]>>, <S as View<'a>>::Type: SplitAt + Set + Dummy,

Source§

type Item = <S as View<'a>>::Type

Source§

type Iter = ChunkedIter<OffsetValuesAndSizes<'a>, <S as View<'a>>::Type>

Source§

fn view_iter(&'a self) -> Self::Iter

Source§

impl<'a, S, O> ViewMut<'a> for Chunked<S, O>
where S: ViewMut<'a>, O: View<'a>,

Source§

fn view_mut(&'a mut self) -> Self::Type

Create a contiguous mutable (unique) view into this set.

§Example
use flatk::*;
let mut s = Chunked::<Vec<usize>>::from_offsets(vec![0,1,4,6], vec![0,1,2,3,4,5]);
let mut v1 = s.view_mut();
v1.iter_mut().next().unwrap()[0] = 100;
let mut view1_iter = v1.iter();
assert_eq!(Some(&[100][..]), view1_iter.next());
assert_eq!(Some(&[1,2,3][..]), view1_iter.next());
assert_eq!(Some(&[4,5][..]), view1_iter.next());
assert_eq!(None, view1_iter.next());
Source§

type Type = Chunked<<S as ViewMut<'a>>::Type, <O as View<'a>>::Type>

Source§

impl<'a, S, O> ViewMutIterator<'a> for Chunked<S, O>
where S: ViewMut<'a>, O: View<'a, Type = Offsets<&'a [usize]>>, <S as ViewMut<'a>>::Type: SplitAt + Set + Dummy,

Source§

type Item = <S as ViewMut<'a>>::Type

Source§

type Iter = ChunkedIter<OffsetValuesAndSizes<'a>, <S as ViewMut<'a>>::Type>

Source§

fn view_mut_iter(&'a mut self) -> Self::Iter

Source§

impl<S: Copy, O: Copy> Copy for Chunked<S, O>

Source§

impl<S, I> DynamicRangeIndexType for Chunked<S, I>

Source§

impl<S, O> StructuralPartialEq for Chunked<S, O>

Source§

impl<S, I> ValueType for Chunked<S, I>

Source§

impl<S: Viewed, I: Viewed> Viewed for Chunked<S, I>

Auto Trait Implementations§

§

impl<S, O> Freeze for Chunked<S, O>
where O: Freeze, S: Freeze,

§

impl<S, O> RefUnwindSafe for Chunked<S, O>

§

impl<S, O> Send for Chunked<S, O>
where O: Send, S: Send,

§

impl<S, O> Sync for Chunked<S, O>
where O: Sync, S: Sync,

§

impl<S, O> Unpin for Chunked<S, O>
where O: Unpin, S: Unpin,

§

impl<S, O> UnwindSafe for Chunked<S, O>
where O: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, S, I> Get<'a, I> for S
where I: GetIndex<'a, S>,

Source§

type Output = <I as GetIndex<'a, S>>::Output

Source§

fn get(&self, idx: I) -> Option<<I as GetIndex<'a, S>>::Output>

Source§

fn at(&self, idx: I) -> Self::Output

Return a value at the given index. This is provided as the checked version of get that will panic if the equivalent get call is None, which typically means that the given index is out of bounds. Read more
Source§

unsafe fn at_unchecked(&self, idx: I) -> Self::Output

Return a value at the given index. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S> IntoChunkIterator for S
where S: Set + SplitAt + Dummy,

Source§

type Item = S

Source§

type IterType = ChunkedNIter<S>

Source§

fn into_chunk_iter( self, chunk_size: usize, ) -> <S as IntoChunkIterator>::IterType

Produce a chunk iterator with the given stride chunk_size. One notable difference between this trait and chunks* methods on slices is that chunks_iter should panic when the underlying data cannot split into chunk_size sized chunks exactly.
Source§

impl<S, I> Isolate<I> for S
where I: IsolateIndex<S>,

Source§

type Output = <I as IsolateIndex<S>>::Output

Source§

unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output

Unchecked version of isolate. Read more
Source§

fn try_isolate(self, idx: I) -> Option<<S as Isolate<I>>::Output>

Source§

fn isolate(self, idx: I) -> Self::Output
where Self: Sized,

Return a value at the given index. This is provided as the checked version of try_isolate that will panic if the equivalent try_isolate call is None, which typically means that the given index is out of bounds. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, N> PushArrayToVec<N> for T
where T: Clone, N: Array<T>,

Source§

fn push_to_vec(element: <N as Array<T>>::Array, set: &mut Vec<T>)

This method tells this type how it can be pushed to a Vec as an array.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T> OwnedSet<'a> for T

Source§

impl<'a, T> ReadSet<'a> for T

Source§

impl<T> StaticallySplittable for T

Source§

impl<'a, T> WriteSet<'a> for T
where T: ReadSet<'a> + ViewMut<'a>,