Any of +Inf, +inf, -inf, -Inf do not get matched by winnow::ascii::float (and presumably any variant of infinity too based on the code).
running 12 tests
test test::test_std_parse_inf_lower ... ok
test test::test_std_parse_inf_camel ... ok
test test::test_std_parse_neg_inf_camel ... ok
test test::test_std_parse_neg_inf_lower ... ok
test test::test_std_parse_pos_inf_camel ... ok
test test::test_std_parse_pos_inf_lower ... ok
test test::test_winnow_parse_inf_camel ... ok
test test::test_winnow_parse_inf_lower ... ok
test test::test_winnow_parse_neg_inf_camel ... FAILED
test test::test_winnow_parse_neg_inf_lower ... FAILED
test test::test_winnow_parse_pos_inf_camel ... FAILED
test test::test_winnow_parse_pos_inf_lower ... FAILED
failures:
---- test::test_winnow_parse_neg_inf_camel stdout ----
thread 'test::test_winnow_parse_neg_inf_camel' panicked at src/lib.rs:72:74:
called `Result::unwrap()` on an `Err` value: Backtrack(ContextError { context: [], cause: None })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- test::test_winnow_parse_neg_inf_lower stdout ----
thread 'test::test_winnow_parse_neg_inf_lower' panicked at src/lib.rs:96:74:
called `Result::unwrap()` on an `Err` value: Backtrack(ContextError { context: [], cause: None })
---- test::test_winnow_parse_pos_inf_camel stdout ----
thread 'test::test_winnow_parse_pos_inf_camel' panicked at src/lib.rs:64:74:
called `Result::unwrap()` on an `Err` value: Backtrack(ContextError { context: [], cause: None })
---- test::test_winnow_parse_pos_inf_lower stdout ----
thread 'test::test_winnow_parse_pos_inf_lower' panicked at src/lib.rs:88:74:
called `Result::unwrap()` on an `Err` value: Backtrack(ContextError { context: [], cause: None })
Expected Behaviour
I think winnow::ascii::float should ideally match whatever parse::<f64>() can parse.
Both +inf and -inf are separate values as per IEEE-754, so it makes sense to be able to parse both.
My personal motivation for the change comes from trying to parse an example from the prometheus metric exposition format examples, in which the +Inf value is currently unable to be parsed.
something_weird{problem="division by zero"} +Inf -3982045
FYI I generally see float, dec_int, etc as conveniences for prototyping and the expected syntax is not too clear. However, I am fine moving forward with this.
Please complete the following tasks
rust version
rustc 1.75.0 (82e1608df 2023-12-21)
winnow version
0.5.31
Minimal reproducible code
Link to playground
Steps to reproduce the bug with the above code
cargo test
or runTest
in the playground exampleActual Behaviour
Any of
+Inf
,+inf
,-inf
,-Inf
do not get matched bywinnow::ascii::float
(and presumably any variant ofinfinity
too based on the code).Expected Behaviour
winnow::ascii::float
should ideally match whateverparse::<f64>()
can parse.+inf
and-inf
are separate values as per IEEE-754, so it makes sense to be able to parse both.+Inf
value is currently unable to be parsed.