decimal
decimal copied to clipboard
d128::from_str() returns Ok on non valid inputs
d128::from_str("Not_Valid_String") returns Ok with a "NaN" value result.
this is explained in the documentation:
The syntax of the string is fully checked; if it is not valid, the result will be a quiet NaN and an error flag will be set.
Another clue is the Err
type of the FromStr
impl is ()
.
Although this is not an idiomatic FromStr
implementation, it has been this way for years now so at this point breaking this behavior could break people's code that expected it.