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§
Required Methods§
Provided Methods§
Sourcefn 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.
Implementations on Foreign Types§
Source§impl SignedIndex for i32
Available on 32-bit or 64-bit or 128-bit only.
impl SignedIndex for i32
Available on 32-bit or 64-bit or 128-bit only.
Source§impl SignedIndex for i64
Available on 64-bit or 128-bit only.
impl SignedIndex for i64
Available on 64-bit or 128-bit only.