Trait Index

Source
pub trait Index: Sized {
    // Required methods
    fn is_zero(&self) -> bool;
    fn decrement(self) -> Self;
    fn checked_add(self, other: &Self) -> Option<Self>;
}
Expand description

A type suitable for indexing into PrefixSumVec.

Required Methods§

Source

fn is_zero(&self) -> bool

Is the value zero?

Source

fn decrement(self) -> Self

Decrement the index by one.

This will never be called for values for which is_zero returns true.

Source

fn checked_add(self, other: &Self) -> Option<Self>

Add the two indices together, checking for overflow.

In case an overflow occurs, this must return None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Index for i8

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for i16

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for i32

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for i64

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for i128

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for isize

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for u8

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for u16

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for u32

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for u64

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for u128

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Source§

impl Index for usize

Source§

fn is_zero(&self) -> bool

Source§

fn decrement(self) -> Self

Source§

fn checked_add(self, other: &Self) -> Option<Self>

Implementors§