Function mozjs::conversions::enforce_range

source ·
unsafe fn enforce_range<D>(
    cx: *mut JSContext,
    d: f64,
) -> Result<ConversionResult<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, it will return an error.