BurntSushi

jiff

A datetime library for Rust that encourages you to jump into the pit of success.

by BurntSushi

Rust

Rust99.5%
Shell0.4%
Lua0%

Commit activity

Last 12 weeks · 84 commits

Full graph →

Community health

3 of 6 standards met

Community profile →
57
✓README✓License✓Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 12 discussions · Last activity 14h ago
See all on GitHub →
Alexendoo

I have an ETA number of seconds I'd like to display as e.g. , , dropping all but the largest unit and the next unit down Currently I convert the seconds into a and balance/round it with But it'd be nice to be able to do something like

Alexendoo · 8h ago
BurntSushi

There are some possible performance footguns in the design of the type that could prevent Jiff from doing the fastest possible thing. There is some tension between API simplicity and borrowing data via a lifetime parameter. The two obvious candidates for borrowing are a 's value and a 's IANA time zone identifier. It also _seems_ like these two things could be merged, but IIRC, the IANA time zone identifier is a separate field to support parsing identifiers without necessarily eagerly turning it into a . But maybe that's not worth doing. In any case, we could explore adding a lifetime parameter to a . Today it has none. And if we did this, we'd likely need to put them inside wrappers and add routines for "borrowing" or "owning" a . This pattern is actually already used by Jiff in other less prominent places in the API. It can also be found in the crate. I don't really like doing this because I think lifetime/type parameters add cognitive overhead to understanding an API. It's precisely why Jiff is very light on such things already. And in the case of , there are likely only _some_ things that will be borrowed (the data that is non-, which can only come from a value), which makes it... somewhat weird. _With that said_, it is somewhat rare to need to interact with a directly, and it is considered a lower level API. So I'm definitely open to this. I really do not want to add _two_ lifetime parameters though (one for and one for ). If we didn't merge them, we could of course insist that they share a lifetime. Which is... probably reasonable. One thing I haven't thought too much about is the mutator APIs. Right now, for example, mutates the value in place. I think this is still doable with a lifetime parameter, but I'd want to play around with it. We could alternatively only provide the mutator API on . See #494 for an attempt at a change like this and some ensuing discussion.

BurntSushi · 14h ago
Structured data for AI agents

Repository: BurntSushi/jiff. Description: A datetime library for Rust that encourages you to jump into the pit of success. Stars: 3055, Forks: 141. Primary language: Rust. Languages: Rust (99.5%), Shell (0.4%), Lua (0%). License: Unlicense. Topics: calendar, civil, date, date-time, datetime, duration, iana, iso8601, jiff, local, rfc2822, rust, strftime, strptime, temporal, time, timezone, tzdb, utc, zone. Open PRs: 0, open issues: 12. Last activity: 14h ago. Community health: 57%. Top contributors: BurntSushi, fiadliel, musicinmybrain, benjoffe, LeoniePhiline, 1996fanrui, Marsman1996, tisonkun, robertbastian, dickermoshe and others.