Function mozjs::conversions::clamp_to
source · fn clamp_to<D>(d: f64) -> Dwhere
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.