Trait extendr_api::prelude::sparse::linalg::SignedIndex

pub trait SignedIndex:
    Seal
    + Debug
    + Neg<Output = Self>
    + Add<Output = Self>
    + Sub<Output = Self>
    + AddAssign
    + SubAssign
    + Pod
    + Eq
    + Ord
    + Send
    + Sync {
    const MAX: Self;

    // Required methods
    fn truncate(value: usize) -> Self;
    fn zx(self) -> usize;
    fn sx(self) -> usize;

    // Provided method
    fn sum_nonnegative(slice: &[Self]) -> Option<Self> { ... }
}
Expand description

Trait for signed integers corresponding to the ones satisfying Index.

Always smaller than or equal to isize.

Required Associated Constants§

const MAX: Self

Maximum representable value.

Required Methods§

fn truncate(value: usize) -> Self

Truncate value to type Self.

fn zx(self) -> usize

Zero extend self.

fn sx(self) -> usize

Sign extend self.

Provided Methods§

fn sum_nonnegative(slice: &[Self]) -> Option<Self>

Sum nonnegative values while checking for overflow.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl SignedIndex for i32

§

const MAX: i32 = 2_147_483_647i32

§

fn truncate(value: usize) -> i32

§

fn zx(self) -> usize

§

fn sx(self) -> usize

§

impl SignedIndex for i64

§

const MAX: i64 = 9_223_372_036_854_775_807i64

§

fn truncate(value: usize) -> i64

§

fn zx(self) -> usize

§

fn sx(self) -> usize

§

impl SignedIndex for isize

§

const MAX: isize = 9_223_372_036_854_775_807isize

§

fn truncate(value: usize) -> isize

§

fn zx(self) -> usize

§

fn sx(self) -> usize

Implementors§