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

Make CommitmentLevel constructors const #27367

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

fhartwig
Copy link
Contributor

Problem

The CommitmentConfig constructors cannot be used in const contexts. This isn't a big problem because CommitmentConfigs's only field is public, so sdk users can just use e.g. CommitmentConfig{commitment: CommitmentLevel::Finalized} instead of CommitmentConfig::finalized(), but using the latter would be a bit more convenient and there aren't any obvious-to-me reasons not to make the functions const.

Summary of Changes

Make the constructors const.

Fixes #

@mergify mergify bot added the community Community contribution label Aug 24, 2022
@mergify mergify bot requested a review from a team August 24, 2022 09:13
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I don't see any reason not to do this either. That said, a use-case would have been nice; "no reasons not to" is not the same as a reason to do something :)

@CriesofCarrots CriesofCarrots merged commit 12f9213 into solana-labs:master Aug 31, 2022
@fhartwig fhartwig deleted the const-constructors branch September 1, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants