Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making Duration::seconds and similar functions const #638

Closed
wants to merge 3 commits into from

Commits on Dec 22, 2021

  1. Making Duration creation functions const

    This commit updates `Duration::seconds` and siblings to be const. This
    requires the const-panic api that only stabilized in 1.57, so it may be
    best to hide this behid a feature flag somehow so as to not require a
    MSRV of 1.57. This is my first pr so I don't know the policy around
    this.
    
    This pr also adds a bit of mess to the functions because we can't use
    `.expect("error")` or `Datetime::partial_cmp`. I think it is worth it
    because const durations would be really nice to have.
    msdrigg committed Dec 22, 2021
    Configuration menu
    Copy the full SHA
    bc6e8fd View commit details
    Browse the repository at this point in the history
  2. Updating the changelog

    msdrigg committed Dec 22, 2021
    Configuration menu
    Copy the full SHA
    3f4bd2e View commit details
    Browse the repository at this point in the history
  3. Make from_std const as well

    This will make `from_std` const. We can't make `to_std` const until
    `std::time::Duration::new` stabilizes as a const function.
    msdrigg committed Dec 22, 2021
    Configuration menu
    Copy the full SHA
    20ec81c View commit details
    Browse the repository at this point in the history