Trait kas::view::MatrixData

source ·
pub trait MatrixData: SharedData {
    type ColKey;
    type RowKey;
    type ColKeyIter<'b>: Iterator<Item = Self::ColKey>
       where Self: 'b;
    type RowKeyIter<'b>: Iterator<Item = Self::RowKey>
       where Self: 'b;

    // Required methods
    fn is_empty(&self) -> bool;
    fn len(&self) -> (usize, usize);
    fn col_iter_from(&self, start: usize, limit: usize) -> Self::ColKeyIter<'_>;
    fn row_iter_from(&self, start: usize, limit: usize) -> Self::RowKeyIter<'_>;
    fn make_key(&self, col: &Self::ColKey, row: &Self::RowKey) -> Self::Key;

    // Provided methods
    fn col_iter_limit(&self, limit: usize) -> Self::ColKeyIter<'_> { ... }
    fn row_iter_limit(&self, limit: usize) -> Self::RowKeyIter<'_> { ... }
}
Available on crate feature view only.
Expand description

Trait for viewable data matrices

Data matrices are a kind of table where each cell has the same type.

Required Associated Types§

source

type ColKey

Column key type

source

type RowKey

Row key type

source

type ColKeyIter<'b>: Iterator<Item = Self::ColKey> where Self: 'b

source

type RowKeyIter<'b>: Iterator<Item = Self::RowKey> where Self: 'b

Required Methods§

source

fn is_empty(&self) -> bool

No data is available

source

fn len(&self) -> (usize, usize)

Number of (cols, rows) available

Note: users may assume this is O(1).

source

fn col_iter_from(&self, start: usize, limit: usize) -> Self::ColKeyIter<'_>

Iterate over column keys from an arbitrary start-point

The result is the same as self.iter_limit(start + limit).skip(start).

source

fn row_iter_from(&self, start: usize, limit: usize) -> Self::RowKeyIter<'_>

Iterate over row keys from an arbitrary start-point

The result is the same as self.iter_limit(start + limit).skip(start).

source

fn make_key(&self, col: &Self::ColKey, row: &Self::RowKey) -> Self::Key

Make a key from parts

Provided Methods§

source

fn col_iter_limit(&self, limit: usize) -> Self::ColKeyIter<'_>

Iterate over column keys

The result will be in deterministic implementation-defined order, with a length of max(limit, data_len) where data_len is the number of items available.

source

fn row_iter_limit(&self, limit: usize) -> Self::RowKeyIter<'_>

Iterate over row keys

The result will be in deterministic implementation-defined order, with a length of max(limit, data_len) where data_len is the number of items available.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> MatrixData for &T
where T: MatrixData + ?Sized,

§

type ColKey = <T as MatrixData>::ColKey

§

type RowKey = <T as MatrixData>::RowKey

§

type ColKeyIter<'b> = <T as MatrixData>::ColKeyIter<'b> where &T: 'b

§

type RowKeyIter<'b> = <T as MatrixData>::RowKeyIter<'b> where &T: 'b

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> (usize, usize)

source§

fn col_iter_limit(&self, limit: usize) -> <&T as MatrixData>::ColKeyIter<'_>

source§

fn col_iter_from( &self, start: usize, limit: usize ) -> <&T as MatrixData>::ColKeyIter<'_>

source§

fn row_iter_limit(&self, limit: usize) -> <&T as MatrixData>::RowKeyIter<'_>

source§

fn row_iter_from( &self, start: usize, limit: usize ) -> <&T as MatrixData>::RowKeyIter<'_>

source§

fn make_key( &self, col: &<&T as MatrixData>::ColKey, row: &<&T as MatrixData>::RowKey ) -> <&T as SharedData>::Key

source§

impl<T> MatrixData for &mut T
where T: MatrixData + ?Sized,

§

type ColKey = <T as MatrixData>::ColKey

§

type RowKey = <T as MatrixData>::RowKey

§

type ColKeyIter<'b> = <T as MatrixData>::ColKeyIter<'b> where &mut T: 'b

§

type RowKeyIter<'b> = <T as MatrixData>::RowKeyIter<'b> where &mut T: 'b

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> (usize, usize)

source§

fn col_iter_limit(&self, limit: usize) -> <&mut T as MatrixData>::ColKeyIter<'_>

source§

fn col_iter_from( &self, start: usize, limit: usize ) -> <&mut T as MatrixData>::ColKeyIter<'_>

source§

fn row_iter_limit(&self, limit: usize) -> <&mut T as MatrixData>::RowKeyIter<'_>

source§

fn row_iter_from( &self, start: usize, limit: usize ) -> <&mut T as MatrixData>::RowKeyIter<'_>

source§

fn make_key( &self, col: &<&mut T as MatrixData>::ColKey, row: &<&mut T as MatrixData>::RowKey ) -> <&mut T as SharedData>::Key

source§

impl<T> MatrixData for Box<T>
where T: MatrixData + ?Sized,

§

type ColKey = <T as MatrixData>::ColKey

§

type RowKey = <T as MatrixData>::RowKey

§

type ColKeyIter<'b> = <T as MatrixData>::ColKeyIter<'b> where Box<T>: 'b

§

type RowKeyIter<'b> = <T as MatrixData>::RowKeyIter<'b> where Box<T>: 'b

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> (usize, usize)

source§

fn col_iter_limit(&self, limit: usize) -> <Box<T> as MatrixData>::ColKeyIter<'_>

source§

fn col_iter_from( &self, start: usize, limit: usize ) -> <Box<T> as MatrixData>::ColKeyIter<'_>

source§

fn row_iter_limit(&self, limit: usize) -> <Box<T> as MatrixData>::RowKeyIter<'_>

source§

fn row_iter_from( &self, start: usize, limit: usize ) -> <Box<T> as MatrixData>::RowKeyIter<'_>

source§

fn make_key( &self, col: &<Box<T> as MatrixData>::ColKey, row: &<Box<T> as MatrixData>::RowKey ) -> <Box<T> as SharedData>::Key

source§

impl<T> MatrixData for Rc<T>
where T: MatrixData + ?Sized,

§

type ColKey = <T as MatrixData>::ColKey

§

type RowKey = <T as MatrixData>::RowKey

§

type ColKeyIter<'b> = <T as MatrixData>::ColKeyIter<'b> where Rc<T>: 'b

§

type RowKeyIter<'b> = <T as MatrixData>::RowKeyIter<'b> where Rc<T>: 'b

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> (usize, usize)

source§

fn col_iter_limit(&self, limit: usize) -> <Rc<T> as MatrixData>::ColKeyIter<'_>

source§

fn col_iter_from( &self, start: usize, limit: usize ) -> <Rc<T> as MatrixData>::ColKeyIter<'_>

source§

fn row_iter_limit(&self, limit: usize) -> <Rc<T> as MatrixData>::RowKeyIter<'_>

source§

fn row_iter_from( &self, start: usize, limit: usize ) -> <Rc<T> as MatrixData>::RowKeyIter<'_>

source§

fn make_key( &self, col: &<Rc<T> as MatrixData>::ColKey, row: &<Rc<T> as MatrixData>::RowKey ) -> <Rc<T> as SharedData>::Key

source§

impl<T> MatrixData for Arc<T>
where T: MatrixData + ?Sized,

§

type ColKey = <T as MatrixData>::ColKey

§

type RowKey = <T as MatrixData>::RowKey

§

type ColKeyIter<'b> = <T as MatrixData>::ColKeyIter<'b> where Arc<T>: 'b

§

type RowKeyIter<'b> = <T as MatrixData>::RowKeyIter<'b> where Arc<T>: 'b

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> (usize, usize)

source§

fn col_iter_limit(&self, limit: usize) -> <Arc<T> as MatrixData>::ColKeyIter<'_>

source§

fn col_iter_from( &self, start: usize, limit: usize ) -> <Arc<T> as MatrixData>::ColKeyIter<'_>

source§

fn row_iter_limit(&self, limit: usize) -> <Arc<T> as MatrixData>::RowKeyIter<'_>

source§

fn row_iter_from( &self, start: usize, limit: usize ) -> <Arc<T> as MatrixData>::RowKeyIter<'_>

source§

fn make_key( &self, col: &<Arc<T> as MatrixData>::ColKey, row: &<Arc<T> as MatrixData>::RowKey ) -> <Arc<T> as SharedData>::Key

Implementors§