Trait sprs::indexing::SpIndex

source ·
pub trait SpIndex:
    Debug
    + PrimInt
    + AddAssign<Self>
    + Default
    + Send
    + Sync {
    // Required methods
    fn index(self) -> usize;
    fn try_index(self) -> Option<usize>;
    fn index_unchecked(self) -> usize;
    fn from_usize(ind: usize) -> Self;
    fn try_from_usize(ind: usize) -> Option<Self>;
    fn from_usize_unchecked(ind: usize) -> Self;
}
Expand description

A sparse matrix index

This is a convenience trait to enable using various integer sizes for sparse matrix indices.

Required Methods§

source

fn index(self) -> usize

Convert to usize.

§Panics

If the integer cannot be represented as an usize, eg negative numbers.

source

fn try_index(self) -> Option<usize>

Try convert to usize.

source

fn index_unchecked(self) -> usize

Convert to usize without checking for overflows.

source

fn from_usize(ind: usize) -> Self

Convert from usize.

§Panics

If the input overflows the index type.

source

fn try_from_usize(ind: usize) -> Option<Self>

Try convert from usize.

source

fn from_usize_unchecked(ind: usize) -> Self

Convert from usize without checking for overflows.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SpIndex for i16

source§

impl SpIndex for i32

source§

impl SpIndex for i64

source§

impl SpIndex for isize

source§

impl SpIndex for u16

source§

impl SpIndex for u32

source§

impl SpIndex for u64

source§

impl SpIndex for usize

Implementors§