pub trait BoundedInt:
Debug
+ Display
+ Default
+ Eq
+ PartialOrd
+ Ord
+ Copy
+ From<bool>
+ TryInto<usize>
+ TryFrom<usize>
+ TryFrom<u8>
+ TryFrom<u16>
+ TryFrom<u32>
+ TryFrom<u64>
+ TryFrom<u128>
+ TryFrom<isize>
+ TryFrom<i8>
+ TryFrom<i16>
+ TryFrom<i32>
+ TryFrom<i64>
+ TryFrom<i128>where
Self: Sized,{
type Inner;
const MIN: Self;
const MAX: Self;
// Required methods
fn into_inner(self) -> Self::Inner;
fn as_ref(&self) -> &Self::Inner;
fn checked_add(self, rhs: Self) -> Option<Self>;
fn checked_sub(self, rhs: Self) -> Option<Self>;
// Provided methods
fn one() -> Self { ... }
fn inc(self) -> Option<Self> { ... }
fn dec(self) -> Option<Self> { ... }
fn iter() -> BoundedIntIterator<Self> ⓘ { ... }
}Expand description
Trait for bounded integer types.
It’s implemented by default for all builtin integer types, as they all have a min and a max possible value.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Extract the inner value.
Sourcefn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition.
Sourcefn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction.
Provided Methods§
Sourcefn iter() -> BoundedIntIterator<Self> ⓘ
fn iter() -> BoundedIntIterator<Self> ⓘ
Return an iterator for all values of this BoundedInt type.
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.