Trait aint::SaturatingInto

source ·
pub trait SaturatingInto<T> {
    // Required method
    fn saturating_into(self) -> T;
}
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 = 1000.saturating_into();
assert_eq!(value, u8::MAX);

Required Methods§

source

fn saturating_into(self) -> T

Implementors§

source§

impl<F, T> SaturatingInto<T> for F
where T: SaturatingFrom<F>,