Trait 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
const MAX: Self
Maximum representable value.
Required Methods§
Provided Methods§
fn sum_nonnegative(slice: &[Self]) -> Option<Self>
fn sum_nonnegative(slice: &[Self]) -> Option<Self>
Sum nonnegative values while checking for overflow.
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.