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§
Sourcefn decrement(self) -> Self
fn decrement(self) -> Self
Decrement the index by one.
This will never be called for values for which is_zero
returns true
.
Sourcefn checked_add(self, other: &Self) -> Option<Self>
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.