Function mozjs::conversions::clamp_to[][src]

fn clamp_to<D>(d: f64) -> D where
    D: Bounded + As<f64> + Zero,
    f64: As<D>, 
Expand description

Try to cast the number to a smaller type, but if it doesn’t fit, round it to the MAX or MIN of the source type before casting it to the destination type.