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

refactor: Make option types more backwards compatible #117

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

jakoschiko
Copy link
Collaborator

We have two option types: ServerFlowOptions and ClientFlowOptions. We might want to add additional fields to them in the future. It would be nice if we were able to do that without a breaking change. So I propose:

  • Let's make them #[non_exhaustive]. This allows us to add fields.
  • Let's make ClientFlowOptions non-Copy. This allos us to add non-Copy fields.

The Codec types in imap-codec already do this.

Caveat: To my surprise the .. notation does not work with #[non_exhaustive] (maybe in the future, see rust-lang/rust#70564 (comment)). So this doesn't work:

let options = ServerFlowOptions {
  crlf_relaxed: false,
  ..ServerFlowOptions::default()
}

Instead you need to write this:

let mut options = ServerFlowOptions::default();
options.crlf_relaxed = false;

But I'm willing to accept this.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 7843530951

  • -1 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 48.33%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/client.rs 0 1 0.0%
Totals Coverage Status
Change from base Build 7784940186: 0.0%
Covered Lines: 492
Relevant Lines: 1018

💛 - Coveralls

Copy link
Owner

@duesee duesee left a comment

Choose a reason for hiding this comment

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

Sounds good! Thanks!

@jakoschiko jakoschiko merged commit aa90996 into main Feb 9, 2024
10 checks passed
@jakoschiko jakoschiko deleted the jakoschiko_backwards-compatible-options branch February 9, 2024 13:19
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.

3 participants