Skip to main content

is_infallible_numeric_cast

Function is_infallible_numeric_cast 

Source
const fn is_infallible_numeric_cast(from: NumericKind, to: NumericKind) -> bool
Expand description

Returns true if num_cast succeeds for every value of from when casting to to: every cast to a float, and integer casts whose target holds every source value.

This must hold for every bit pattern of the source type, not only for the valid values of a particular array, because [PrimitiveArray::unary] applies the conversion to null slots as well, and their contents are arbitrary.