clamp_to

Function clamp_to 

Source
fn clamp_to<D>(d: f64) -> D
where D: Number + PrimInt + As<f64>, f64: As<D>,
Expand description

WebIDL ConvertToInt (Clamp) conversion. Spec: https://webidl.spec.whatwg.org/#abstract-opdef-converttoint

This function is ported from Gecko’s PrimitiveConversionTraits_Clamp.

§Warning

This function must only be used when the target type D represents an integer WebIDL type. Using it with non-integer types would be incorrect.