Skip to content

RFC: Bring some of the Rubedo extensions for Chrono into Chrono #1392

@danwilliams

Description

@danwilliams

@djc @pitdicker I have a number of pieces of functionality to extend Chrono, which are available under my Rubedo crate, with there being a specific module for the Chrono extensions.

I would like to bring some of that functionality into Chrono, to benefit a wider audience, but I am not sure how much of it is appropriate and would gain approval, so I am raising this RFC ticket to get feedback on that before I spend time bringing anything across into Chrono PRs.

Here are some initial thoughts, although I would welcome perusal of the full page linked to:

  • I see a lot of value in the "full" functions for Duration, which provide constructors and getters for using the full range of nanoseconds and microseconds that a Duration can store. Due to the limitations of the native Chrono functions in this regard, I believe these functions would be useful to have in the main library, and they could even replace the current functions (as they extend the range) - although this would be a breaking change in my view, as they accept/return i128 instead of i64. So perhaps just adding my functions would be sufficient here.
  • I think it would be useful to many people to bring in the additional functions I have for NaiveDate, as they are common operations that have been very helpful in my various project codebases.
  • The other functionality may not be as suitable for a general audience - Duration.humanize() is useful but specific, and I doubt you will want the Months extensions as I know you have a CalendarDuration on the way 🙂
  • I also have a range of constants, which I find useful, but which are not directly beneficial to Chrono because there are other ways of getting the same information. BUT as some of the Chrono constants are not public, it would be great to have permission to revise the available constants and make a sensible and useful range public to people.

I don't know how these suggestions fit in with your plans for v0.5, but I think they can all target v0.4.x as they are fully compatible. I am of course open to adjusting the approach, naming, scope, etc. of any of these functions if you want them brought in, and would also submit them according to Chrono's coding standards as I have done with my other PRs.

Let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions