nix icon indicating copy to clipboard operation
nix copied to clipboard

Use TryFrom for TimeSpec/Duration conversions which may underflow/overflow

Open sirhcel opened this issue 1 year ago • 0 comments
trafficstars

What does this PR do

  • This is a follow-up to #2479 for switching from From to TryFrom for conversions between TimeSpec and Duration which may underflow or overflow
  • I learned that From and TryFrom can not co-exist and so adding the latter and deprecating the former does not seem feasible and it looks like we are left with a breaking change here
  • I'm starting this as a draft PR for
    • Discussing the desired level of detail for reporting errors from TryFrom. The underlying integer conversions return a TryFromIntError which informs that the conversion has failed but gives no specific reason.
    • Getting feedback from CI
    • Adding tests for the conversions once the course for this PR is set
    • Adding a change log once the course for this PR is set

Checklist:

  • [x] I have read CONTRIBUTING.md
  • [ ] I have written necessary tests and rustdoc comments
  • [ ] A change log has been added if this PR modifies nix's API

sirhcel avatar Oct 20 '24 22:10 sirhcel