Sparse

Struct Sparse 

Source
pub struct Sparse<S, T = RangeTo<usize>, I = Vec<usize>> {
    pub selection: Select<T, I>,
    pub source: S,
}
Expand description

A Sparse data set S where the sparsity pattern is given by I as select indices into a larger range.

For example we can represent a sparse vector by assigning values to a selection of indices:

use flatk::{Sparse, Get, View};

let values = vec![1.0, 2.0, 3.0, 4.0];
let sparse_vector = Sparse::from_dim(vec![0,5,10,100], 1000, values);
let sparse_vector_view = sparse_vector.view();

assert_eq!(sparse_vector_view.at(0), (0, &1.0));
assert_eq!(sparse_vector_view.at(1), (5, &2.0));
assert_eq!(sparse_vector_view.at(2), (10, &3.0));
assert_eq!(sparse_vector_view.at(3), (100, &4.0));
assert_eq!(sparse_vector_view.selection.target, ..1000);

In this scenario, the target set is just the range 0..1000, however in general this can be any data set, which makes Sparse an implementation of a one-to-one mapping or a directed graph with disjoint source and target node sets.

Fields§

§selection: Select<T, I>§source: S

Implementations§

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoParallelIterator, <<S as View<'a>>::Type as IntoParallelIterator>::Iter: IndexedParallelIterator, T: Set + Get<'a, usize> + View<'a> + Sync, T::Output: Send, I: AsIndexSlice + Sync,

Source

pub fn par_iter( &'a self, ) -> impl IndexedParallelIterator<Item = (usize, <<S as View<'a>>::Type as IntoParallelIterator>::Item, <T as Get<'a, usize>>::Output)>

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

Source§

impl<'a, S, T, I> Sparse<S, T, I>

Source

pub fn par_iter_mut( &'a mut self, ) -> Zip<IterMut<'a, usize>, <<S as ViewMut<'a>>::Type as IntoParallelIterator>::Iter>

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

Source§

impl<S, I> Sparse<S, RangeTo<usize>, I>
where S: Set, I: AsIndexSlice,

Source

pub fn from_dim(indices: I, dim: usize, values: S) -> Self

Create a sparse collection from the given set of indices, a dimension and a set of values.

The corresponding sparse collection will represent a collection of size dim which stores only the given values at the specified indices. Note that dim may be smaller than values.len(), in which case a position in the sparse data structure may contain multiple values.

§Example
use flatk::*;
let v = vec![1,2,3,4,5,6];
let sparse = Sparse::from_dim(vec![0,2,0,2,0,3], 4, v.as_slice());

// The iterator traverses only non-vacant elements.
let mut iter = sparse.iter(); // Returns (position, source, target) triplets
assert_eq!(Some((0, &1, 0)), iter.next());
assert_eq!(Some((2, &2, 2)), iter.next());
assert_eq!(Some((0, &3, 0)), iter.next());
assert_eq!(Some((2, &4, 2)), iter.next());
assert_eq!(Some((0, &5, 0)), iter.next());
assert_eq!(Some((3, &6, 3)), iter.next());
assert_eq!(None, iter.next());
Source§

impl<S, T, I> Sparse<S, T, I>
where S: Set, T: Set, I: AsIndexSlice,

Source

pub fn new(selection: Select<T, I>, source: S) -> Self

The most general constructor for a sparse collection taking a selection of values and their corresponding data.

§Panics

This function will panic if selection and source have different sizes.

Source§

impl<S: Set, T, I> Sparse<S, T, I>

Source

pub fn extend_pruned<S2, T2, I2, B>( &mut self, other: Sparse<S2, T2, I2>, combine: impl FnMut(usize, &mut B::Owned, B), keep: impl FnMut(usize, &B::Owned) -> bool, map: impl FnMut(usize, usize), )
where S2: IntoIterator<Item = B>, I2: AsIndexSlice, B: IntoOwned, Self: Push<(usize, B::Owned)>,

Extend the current sparse collection with a pruned and compressed version of the given sparse collection, other.

Each element is in the original sparse collection is guaranteed to be passed to exactly one of keep or combine.

The keep function will get the combined value of all consecutively overlapping elements, and the source index of the first element in the consecutive group.

The map function allows the caller to map between original other sparse collection and the newly populated collection self. The first parameter passed into map is the index in the output sparse array where each element is being considered for insertion. The second parameter is the position of each element in the output sparse structure. Note that map is not called on pruned elements.

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

// Create a sparse vector with overlapping elements:
// [0] -> 1            [0] -> 5
// [1] ->              [1] ->
// [2] -> 2 + 3 + 4    [2] ->
// [3] ->              [3] -> 6
let sparse = Sparse::from_dim(vec![0,2,2,2,0,3], 4, v.as_slice());

// Create an empty sparse vector.
let mut compressed = Sparse::from_dim(Vec::new(), 4, Vec::new());

// Transfer the elements from `sparse` into `compressed` while resolving the consecutive overlaps:
compressed.extend_pruned(sparse, |_pos, a, b| *a += *b, |_pos, _val| true, |_src_idx, _dst_idx, | {});
let mut iter = compressed.iter(); // Returns (position, source, target) triplets.
assert_eq!(Some((0, &1, 0)), iter.next());
assert_eq!(Some((2, &9, 2)), iter.next());
assert_eq!(Some((0, &5, 0)), iter.next());
assert_eq!(Some((3, &6, 3)), iter.next());
assert_eq!(None, iter.next());
// Note: 1 and 5 are not merged because they are not consecutive.
Source§

impl<'a, S, T, I> Sparse<S, T, I>

Source

pub fn source(&self) -> &S

Get a reference to the underlying source data.

Source

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

Get a mutable reference to the underlying source data.

Source

pub fn selection(&self) -> &Select<T, I>

Get a reference to the underlying selection.

Source

pub fn selection_mut(&mut self) -> &mut Select<T, I>

Source

pub fn indices(&self) -> &I

Get a reference to the underlying indices.

Source

pub fn indices_mut(&mut self) -> &mut I

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoIterator, T: Set + Get<'a, usize> + View<'a>, I: AsIndexSlice,

Source

pub fn iter( &'a self, ) -> impl Iterator<Item = (usize, <<S as View<'a>>::Type as IntoIterator>::Item, <T as Get<'a, usize>>::Output)>

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoIterator,

Source

pub fn source_iter( &'a self, ) -> <<S as View<'a>>::Type as IntoIterator>::IntoIter

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where I: AsIndexSlice,

Source

pub fn index_iter(&'a self) -> Cloned<Iter<'a, usize>>

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoIterator, I: AsIndexSlice,

Source

pub fn indexed_source_iter( &'a self, ) -> Zip<Cloned<Iter<'a, usize>>, <<S as View<'a>>::Type as IntoIterator>::IntoIter>

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: ViewMut<'a>, <S as ViewMut<'a>>::Type: Set + IntoIterator,

A mutable iterator over the source elements in S

Source

pub fn source_iter_mut( &'a mut self, ) -> <<S as ViewMut<'a>>::Type as IntoIterator>::IntoIter

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: ViewMut<'a>, <S as ViewMut<'a>>::Type: Set + IntoIterator, I: AsIndexSlice,

A mutable iterator can only iterate over the source elements in S and not the target elements in T since we would need scheduling to modify potentially overlapping mutable references.

Source

pub fn indexed_source_iter_mut( &'a mut self, ) -> impl Iterator<Item = (usize, <<S as ViewMut<'a>>::Type as IntoIterator>::Item)>

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: ViewMut<'a>, <S as ViewMut<'a>>::Type: Set + IntoIterator, I: AsMut<[usize]>,

A mutable iterator can only iterate over the source elements in S and not the target elements in T since we would need scheduling to modify potentially overlapping mutable references.

Source

pub fn iter_mut( &'a mut self, ) -> Zip<IterMut<'a, usize>, <<S as ViewMut<'a>>::Type as IntoIterator>::IntoIter>

Source§

impl<'a, S, T, I> Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoIterator, I: AsMut<[usize]>,

Mutably iterate over the selected indices.

Source

pub fn index_iter_mut( &'a mut self, ) -> impl Iterator<Item = (&'a mut usize, <<S as View<'a>>::Type as IntoIterator>::Item)>

Source§

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

Source

pub fn trim(&mut self) -> usize

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

§Example
use flatk::*;
let mut s = Sparse::from_dim(vec![0,1,2], 3, 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.source_mut().transfer_forward(2, 2);
assert_eq!(6, s.storage().len());
assert_eq!(3, s.len());

s.trim(); // remove unindexed elements.
assert_eq!(4, s.storage().len());

Trait Implementations§

Source§

impl<'a, S, T, I> AtomIterator<'a> for Sparse<S, T, I>
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, T, I> AtomMutIterator<'a> for Sparse<S, T, I>
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: ChunkSize, T, I> ChunkSize for Sparse<S, T, I>

Source§

impl<S: Clear, T, I: Clear> Clear for Sparse<S, T, I>

Source§

fn clear(&mut self)

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

impl<S: Clone, T: Clone, I: Clone> Clone for Sparse<S, T, I>

Source§

fn clone(&self) -> Sparse<S, T, I>

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: Clone, S: CloneWithStorage<U>, I: Clone, U> CloneWithStorage<U> for Sparse<S, T, I>

Source§

type CloneType = Sparse<<S as CloneWithStorage<U>>::CloneType, T, I>

Source§

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

Source§

impl<S: Debug, T: Debug, I: Debug> Debug for Sparse<S, T, I>

Source§

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

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

impl<S: Dummy, T: Dummy, I: Dummy> Dummy for Sparse<S, T, I>

Source§

unsafe fn dummy() -> Self

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

impl<S, T> Extend<(usize, <S as Set>::Elem)> for Sparse<S, T>
where S: Set + Extend<<S as Set>::Elem>,

Source§

fn extend<It: IntoIterator<Item = (usize, <S as Set>::Elem)>>( &mut self, iter: It, )

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, S, T, I> GetIndex<'a, Sparse<S, T, I>> for &usize
where I: AsIndexSlice, S: Get<'a, usize>,

Source§

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

Source§

fn get(self, sparse: &Sparse<S, T, I>) -> Option<Self::Output>

Gets the value in the set at this index.
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, T, I> GetIndex<'a, Sparse<S, T, I>> for usize
where I: AsIndexSlice, S: Get<'a, usize>,

Source§

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

Source§

fn get(self, sparse: &Sparse<S, T, I>) -> Option<Self::Output>

Gets the value in the set at this index.
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<S: IntoOwned, T: IntoOwned, I: IntoOwned> IntoOwned for Sparse<S, T, I>

Source§

type Owned = Sparse<<S as IntoOwned>::Owned, <T as IntoOwned>::Owned, <I as IntoOwned>::Owned>

Source§

fn into_owned(self) -> Self::Owned

Source§

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

Source§

impl<S, T, I> IntoOwnedData for Sparse<S, T, I>
where S: IntoOwnedData,

Source§

type OwnedData = Sparse<<S as IntoOwnedData>::OwnedData, T, I>

Source§

fn into_owned_data(self) -> Self::OwnedData

Source§

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

Source§

impl<S, T, I> IntoParallelIterator for Sparse<S, T, I>

Source§

type Item = (usize, <S as SplitFirst>::First)

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

type Iter = SparseParIter<I, 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, T, I> IntoStorage for Sparse<S, T, I>

Source§

fn into_storage(self) -> Self::StorageType

Convert the sparse set into its raw storage representation.

Source§

type StorageType = <S as IntoStorage>::StorageType

Source§

impl<S, T, I> IsolateIndex<Sparse<S, T, I>> for Range<usize>
where S: Isolate<Range<usize>>, I: Isolate<Range<usize>>,

Source§

type Output = Sparse<<S as Isolate<Range<usize>>>::Output, T, <I as Isolate<Range<usize>>>::Output>

Source§

unsafe fn isolate_unchecked(self, sparse: Sparse<S, T, I>) -> Self::Output

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

fn try_isolate(self, sparse: Sparse<S, T, I>) -> Option<Self::Output>

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

impl<S, T, I> IsolateIndex<Sparse<S, T, I>> for usize

Source§

type Output = (<I as Isolate<usize>>::Output, <S as Isolate<usize>>::Output, <T as Isolate<usize>>::Output)

Source§

unsafe fn isolate_unchecked(self, sparse: Sparse<S, T, I>) -> Self::Output

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

fn try_isolate(self, sparse: Sparse<S, T, I>) -> Option<Self::Output>

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

impl<S: MapStorage<Out>, T, I, Out> MapStorage<Out> for Sparse<S, T, I>

Source§

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

Source§

type Output = Sparse<<S as MapStorage<Out>>::Output, T, I>

Source§

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

Source§

impl<S: PartialEq, T: PartialEq, I: PartialEq> PartialEq for Sparse<S, T, I>

Source§

fn eq(&self, other: &Sparse<S, T, I>) -> 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: PermuteInPlace, T, I: PermuteInPlace> PermuteInPlace for Sparse<S, T, I>

Source§

fn permute_in_place(&mut self, permutation: &[usize], seen: &mut [bool])

Source§

impl<S, T, I, A> Push<(usize, A)> for Sparse<S, T, I>
where S: Set<Elem = A> + Push<A>, I: Push<usize>,

Source§

fn push(&mut self, (index, elem): (usize, A))

Source§

impl<S: RemovePrefix, T, I: RemovePrefix> RemovePrefix for Sparse<S, T, I>

Source§

fn remove_prefix(&mut self, n: usize)

Remove n elements from the beginning.
Source§

impl<S: Reserve, T, I: Reserve> Reserve for Sparse<S, T, I>

Source§

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

Source§

fn reserve(&mut self, n: usize)

Source§

impl<S: Set, T, I> Set for Sparse<S, T, I>

Source§

fn len(&self) -> usize

Get the length of this sparse collection.

§Example
use flatk::*;
let v = vec![1,2,3,4,5];
let sparse = Sparse::from_dim(vec![0,2,2,1,1], 3, v.as_slice());
assert_eq!(5, sparse.len());
Source§

type Elem = (usize, <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, T, I> SplitAt for Sparse<S, T, I>
where S: Set + SplitAt, T: Set + Clone, I: SplitAt,

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: Storage, T, I> Storage for Sparse<S, T, I>

Source§

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

Return an immutable reference to the underlying storage type of source data.

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

type Storage = <S as Storage>::Storage

Source§

impl<S: StorageInto<U>, T, I, U> StorageInto<U> for Sparse<S, T, I>

Pass through the conversion for structure type Subset.

Source§

type Output = Sparse<<S as StorageInto<U>>::Output, T, I>

Source§

fn storage_into(self) -> Self::Output

Source§

impl<S: StorageMut, T, I> StorageMut for Sparse<S, T, I>

Source§

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

Return a mutable reference to the underlying storage type of source data.

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

impl<'a, S: StorageView<'a>, T, I> StorageView<'a> for Sparse<S, T, I>

Source§

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

Return a view to the underlying storage type of source data.

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

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

Source§

impl<S: Truncate, T, I: Truncate> Truncate for Sparse<S, T, I>

Source§

fn truncate(&mut self, new_len: usize)

Source§

impl<S, T, I, M> UniChunkable<M> for Sparse<S, T, I>

Source§

type Chunk = Sparse<S, T, I>

Source§

impl<'a, S, T, I> View<'a> for Sparse<S, T, I>
where S: View<'a>, T: View<'a>, I: AsIndexSlice,

Source§

type Type = Sparse<<S as View<'a>>::Type, <T as View<'a>>::Type, &'a [usize]>

Source§

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

Source§

impl<'a, S, T, I> ViewIterator<'a> for Sparse<S, T, I>
where S: View<'a>, <S as View<'a>>::Type: Set + IntoIterator,

Source§

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

Source§

type Iter = <<S as View<'a>>::Type as IntoIterator>::IntoIter

Source§

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

Source§

impl<'a, S, T, I> ViewMut<'a> for Sparse<S, T, I>
where S: Set + ViewMut<'a>, T: Set + View<'a>, I: AsMut<[usize]>,

Source§

type Type = Sparse<<S as ViewMut<'a>>::Type, <T as View<'a>>::Type, &'a mut [usize]>

Source§

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

Source§

impl<'a, S, T, I> ViewMutIterator<'a> for Sparse<S, T, I>
where S: ViewMut<'a>, <S as ViewMut<'a>>::Type: Set + IntoIterator,

Source§

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

Source§

type Iter = <<S as ViewMut<'a>>::Type as IntoIterator>::IntoIter

Source§

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

Source§

impl<S: Copy, T: Copy, I: Copy> Copy for Sparse<S, T, I>

Source§

impl<S, T, I> DynamicRangeIndexType for Sparse<S, T, I>

Source§

impl<S, T, I> StructuralPartialEq for Sparse<S, T, I>

Source§

impl<S, T, I> ValueType for Sparse<S, T, I>

Source§

impl<S: Viewed, T: Viewed, I: Viewed> Viewed for Sparse<S, T, I>

Auto Trait Implementations§

§

impl<S, T, I> Freeze for Sparse<S, T, I>
where S: Freeze, I: Freeze, T: Freeze,

§

impl<S, T, I> RefUnwindSafe for Sparse<S, T, I>

§

impl<S, T, I> Send for Sparse<S, T, I>
where S: Send, I: Send, T: Send,

§

impl<S, T, I> Sync for Sparse<S, T, I>
where S: Sync, I: Sync, T: Sync,

§

impl<S, T, I> Unpin for Sparse<S, T, I>
where S: Unpin, I: Unpin, T: Unpin,

§

impl<S, T, I> UnwindSafe for Sparse<S, T, I>
where S: UnwindSafe, I: UnwindSafe, T: 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.