cat_gateway::service::utilities::convert

Function from_saturating

source
pub(crate) fn from_saturating<R: Copy + Zero + Bounded, T: Copy + TryInto<R> + Sub<Output = T> + PartialOrd<T> + Zero>(
    value: T,
) -> R
Expand description

Convert an <T> to <R>. (saturate if out of range.) Note can convert any int to float, or f32 to f64 as well. can not convert from float to int, or f64 to f32.