winnow_datetime 0,1, winnow_rfc3339 0.1 and winnow_iso8601 0.4 #711
soulstompp
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After porting the iso8601 crate over to winnow_iso8601 and getting it to 0.3, I had a pretty solid ISO8601 and almost immediately needed an RFC339 parser for a separate project. So I split out what was shared between the two and put the shared parsers and the AST in the winnow_datetime crate.
The winnow_datetime crate remains pretty similar to winnow_iso8601 and the parsers should work anywhere that a core winnow parser would. Multiple format-specific can be used together, so you could parse an ISO8601 date followed by a RFC3339 separated by a ‘~’ if you happen to be particularly unlucky.
In addition to parsers, winnow_datetime_assert is available to help ensure the format-specific parsers are parsing the correct values are parsed correctly and that incorrect formats (valid formats from other standards) are refused. All values shown in the image here are tested against each of the appropriate parsers and ensures that it is either parsed or rejected as appropriate. I got the values for the winnow_datetime_assert assertions and the image for this post at https://ijmacd.github.io/rfc3339-iso8601/.
The crates currently included in the winnow_datetime:
winnow-datetime - core crate with base parsers and AST
winnow_rfc3339 - parsers for RFC3339 dates and times, this is probably the one you are looking for.
winnow_iso8601 - parsers for ISO8601 dates, times, durations, and intervals.
winnow_datetime_assert - provides macros for building test and benchmark binaries for format-specific parser
I hope these are useful to the rest of the winnow community and will provide updates here as I get additional formats (SQL dates) and conversions (jiffy) working.
Beta Was this translation helpful? Give feedback.
All reactions