Function mozjs::conversions::clamp_to

source ·
fn clamp_to<D>(d: f64) -> D
where D: Number + As<f64>, 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.