Open jun-sheaf opened 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.7%. Comparing base (
4a74924
) to head (956d90d
). Report is 41 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Can you elaborate on your use case? Even within this repository the values are used in very few locations, all of which could easily be replaced without issue.
Can you elaborate on your use case? Even within this repository the values are used in very few locations, all of which could easily be replaced without issue.
We have a scheduling app that accepts missing start and end times. To make computations easier, we replace these bounds with actual values, specifically Time::MIN
and Time::MAX
.
In that case, why wouldn't you want to be explicit about the exact value being added?
In that case, why wouldn't you want to be explicit about the exact value being added?
We are being explicit. By not specifying the range ends, you opt in to MIN as the minimum and MAX as the maximum. We could enforce using MIN instead of a missing lower bound, but for the upper bound, the problem is slightly more difficult as specifying an upper bound is dependent on the precision.
That said, we were able to workaround MIN/MAX by subtracting 1.nanosecond() from MIDNIGHT. If you're not convinced of this PR, maybe we can add some documentation about max bounds and how to achieve them (perhaps using the workaround just mentioned).
@jhpratt Gentle ping, could you please take a look? If you feel this PR isn't useful, please close.
I've decided that this would cause minimal confusion given that Ord
is already implemented. However, MIDNIGHT
already exists with identical semantics as MIN
, so I'd like to avoid exposing that (I'll probably look into removing it). I would accept an update that makes MAX
and only MAX
public. You can put #[doc(alias = "MIN")]
on MIDNIGHT
if you'd like as well.
This PR exposes the internal max/min values for
Time
. These are useful for building ranges.