Skip to content

Conversation

@BurntSushi
Copy link
Owner

Pretty much what it says on the tin.

This continues in a similar vein as #480.

This continues the journey started in 808905c.
This also rips them out of the utility functions in `fmt`. (This was
already intentionally quite light on ranged integer usage, since I had
written that code recently and figured I'd be ripping things out.) This
did require defining more bounds types, including, notably, the bounds
for `Span` and for `Timestamp`.
This was driving be bonkers. Everything else uses `print.rs` (when
parsing and printing are in separate modules).
I did this originally to aid error messages by reflecting back precisely
what was in the input. But I've been trending away from that, and we
should be able to get most of the value here by just using the `Display`
impls of what we parsed. That's what we do here.

Happily, this seems to result in a speed-up:

```
$ critcmp baseline x01 -f civil_datetime
group                        baseline                               x01
-----                        --------                               ---
parse/civil_datetime/jiff    1.42     24.9±0.16ns        ? ?/sec    1.00     17.5±0.20ns        ? ?/sec
```

Which makes sense. Previously, we were infecting the happy path with
code for capturing the input. But really, that should be on the unhappy
path (i.e., error handling/printing).
This should now include the new `Bounds` error type.
The `jiff::fmt` module is now completely free of ranged integer types.

w00t.

Easier than I expected, but I also suspected this would be one of the
easier parts of the migration since `jiff::fmt` lives at the boundaries.
@BurntSushi BurntSushi merged commit 66ba0fe into master Jan 12, 2026
40 checks passed
@BurntSushi BurntSushi deleted the ag/rm-range-02 branch January 12, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants