Skip to content

Removes deriving Default for enums.#3

Open
bradnelson wants to merge 1 commit intoBlyschak:mainfrom
bradnelson:bradnelson/no_enum_default_derive
Open

Removes deriving Default for enums.#3
bradnelson wants to merge 1 commit intoBlyschak:mainfrom
bradnelson:bradnelson/no_enum_default_derive

Conversation

@bradnelson
Copy link

Solves #2.

Thoughts?

@Blyschak
Copy link
Owner

Blyschak commented Nov 4, 2022

Hi, Thanks for raising PR. Sorry for late response, this crate was developed for my pet project and I had no spare time letely to work on it. I am glad to see it is useful for others.

Derive default trait for enums was stabilized in Rust 1.62 (does not require nightly anymore). Is upgrading your rust compiler an option?

If not, I am Ok to implement Default manually:

impl Default for OneshotTimer {
    fn default() -> Self {
        Self::Expired
    }
}

and

impl Default for PeriodicTimer {
    fn default() -> Self {
        Self::Stopped
    }
}

@bradnelson
Copy link
Author

No worries, thanks for getting back to me!

This is definitely the better option, I think.

Re bumping to the latest version - I do for personal/exploratory development, for sure. Unfortunately, once projects hit a production state, for reproducibility and CI reasons, the compiler versions often get fixed for periods of time and are only bumped maybe once every 6-12 months. We probably won't be bumping our Rust compiler version until the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants