[][src]Trait flatk::Set

pub trait Set {
    type Elem;
    type Atom;
    fn len(&self) -> usize;

    fn is_empty(&self) -> bool { ... }
}

A trait defining a raw buffer of data. This data is typed but not annotated so it can represent anything. For example a buffer of floats can represent a set of vertex colours or vertex positions.

Associated Types

type Elem

Owned element of the set.

type Atom

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

Loading content...

Required methods

fn len(&self) -> usize

Loading content...

Provided methods

fn is_empty(&self) -> bool

Loading content...

Implementations on Foreign Types

impl<T> Set for [T; 1][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 2][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 3][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 4][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 5][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 6][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 7][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 8][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 9][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 10][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 11][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 12][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 13][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 14][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 15][src]

type Elem = T

type Atom = T

impl<T> Set for [T; 16][src]

type Elem = T

type Atom = T

impl<S: Set> Set for Box<S>[src]

type Elem = S::Elem

type Atom = S::Atom

impl<I: IntBound> Set for Range<I>[src]

type Elem = Self::Index

type Atom = Self::Index

impl<I: IntBound> Set for RangeInclusive<I>[src]

type Elem = Self::Index

type Atom = Self::Index

impl<I: IntBound> Set for RangeTo<I>[src]

type Elem = Self::Index

type Atom = Self::Index

impl<I: IntBound> Set for RangeToInclusive<I>[src]

type Elem = Self::Index

type Atom = Self::Index

impl<T> Set for [T][src]

type Elem = T

type Atom = T

impl<S: Set, T: Set> Set for (S, T)[src]

type Elem = (S::Elem, T::Elem)

type Atom = (S::Atom, T::Atom)

impl<T> Set for Vec<T>[src]

type Elem = T

type Atom = T

impl<'_, S: Set + ?Sized> Set for &'_ S[src]

type Elem = <S as Set>::Elem

type Atom = <S as Set>::Elem

impl<'_, S: Set + ?Sized> Set for &'_ mut S[src]

type Elem = <S as Set>::Elem

type Atom = <S as Set>::Elem

impl<'_, S: Set + ?Sized> Set for Ref<'_, S>[src]

type Elem = <S as Set>::Elem

type Atom = <S as Set>::Elem

impl<'_, S: Set + ?Sized> Set for RefMut<'_, S>[src]

type Elem = <S as Set>::Elem

type Atom = <S as Set>::Elem

Loading content...

Implementors

impl<N: Unsigned> Set for StaticRange<N>[src]

type Elem = usize

type Atom = usize

impl<O: Set> Set for Offsets<O>[src]

type Elem = O::Elem

type Atom = O::Atom

impl<O: Set> Set for SortedChunks<O>[src]

type Elem = O::Elem

type Atom = O::Atom

impl<S, O> Set for Chunked<S, O> where
    S: Set,
    O: Set
[src]

type Elem = Vec<S::Elem>

type Atom = S::Atom

fn len(&self) -> usize[src]

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

impl<S: Set + UniChunkable<N>, N: Unsigned> Set for UniChunked<S, U<N>>[src]

An implementation of Set for a UniChunked collection of any type that can be grouped as N sub-elements.

type Elem = S::Chunk

type Atom = S::Atom

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 = UniChunked::<_, U2>::from_flat(vec![0,1,2,3,4,5]);
assert_eq!(s.len(), 3);
let s = UniChunked::<_, U3>::from_flat(vec![0,1,2,3,4,5]);
assert_eq!(s.len(), 2);

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>

type Atom = S::Atom

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);

impl<S: Set, I: AsRef<[usize]>> Set for Select<S, I>[src]

type Elem = S::Elem

type Atom = S::Atom

fn len(&self) -> usize[src]

Get the number of selected elements.

Example

use flatk::*;
let v = vec![1,2,3,4,5];
let selection = Select::new(vec![4,0,1,4], v.as_slice());
assert_eq!(4, selection.len());

impl<S: Set, I: AsRef<[usize]>> Set for Subset<S, I>[src]

Required for Chunked and UniChunked subsets.

type Elem = S::Elem

type Atom = S::Atom

fn len(&self) -> usize[src]

Get the length of this subset.

Example

use flatk::*;
let v = vec![1,2,3,4,5];
let subset = Subset::from_indices(vec![0,2,4], v.as_slice());
assert_eq!(3, subset.len());

impl<S: Set, T, I> Set for Sparse<S, T, I>[src]

type Elem = (usize, S::Elem)

type Atom = S::Atom

fn len(&self) -> usize[src]

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());
Loading content...