Skip to main content

usize_from_f64

Function usize_from_f64 

Source
pub fn usize_from_f64(val: f64) -> Result<usize, Error>
Expand description

Converts a representable nonnegative f64 to usize by truncating toward zero.

Negative, non-finite, and out-of-range values return Error::Arithmetic. Negative zero is accepted; valid fractional values are truncated toward zero.