Trait aint::SaturatingFrom
source · pub trait SaturatingFrom<T> {
// Required method
fn saturating_from(value: T) -> Self;
}
Expand description
Saturating conversion from one type into another.
When the source value is too large to be represented by the destination type, resulting value is saturated to the bounds of the destination type.
Example:
let value = u8::saturating_from(1000);
assert_eq!(value, u8::MAX);
Required Methods§
fn saturating_from(value: T) -> Self
Object Safety§
This trait is not object safe.