Skip to content

RUST-2369 Add constructor methods for ReadPreference#1732

Merged
abr-egn merged 1 commit into
mongodb:mainfrom
OnjoujiToki:RUST-2369-readpreference-constructors
Jul 8, 2026
Merged

RUST-2369 Add constructor methods for ReadPreference#1732
abr-egn merged 1 commit into
mongodb:mainfrom
OnjoujiToki:RUST-2369-readpreference-constructors

Conversation

@OnjoujiToki

@OnjoujiToki OnjoujiToki commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Hi here, playing Mongo for a while so trying to get exposure to driver side's world as well.
Picking some small wins here: RUST-2369 if you don't mind.

This pr adds public constructor methods to ReadPreference so users can build variants without the verbose struct syntax.
Before:

let rp = ReadPreference::PrimaryPreferred { options: None };

After:

let rp = ReadPreference::primary_preferred(None);
let rp = ReadPreference::primary_preferred(options);

thanks for review in advance.
if I've missed any convention here, please let me know and I'll fix it right away.

@OnjoujiToki
OnjoujiToki requested a review from a team as a code owner July 5, 2026 07:45
@OnjoujiToki
OnjoujiToki requested a review from abr-egn July 5, 2026 07:45
@abr-egn

abr-egn commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Thank you, this is a nice ergonomic improvement! Can you please rebase to pick up 22ee8fd, the tests won't pass without that.

@OnjoujiToki
OnjoujiToki force-pushed the RUST-2369-readpreference-constructors branch from 2a11e20 to 97a1f3d Compare July 8, 2026 02:50
@OnjoujiToki

OnjoujiToki commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review! @abr-egn
Sorry for the late reply -- wasn't a wfh day for me. Just rebased onto that commit. Out of curiosity, is there a specific reason for rebasing onto that commit rather than the latest merged one? Still getting familiar with the testing setup here, so apologies if this is a naive question!

@OnjoujiToki
OnjoujiToki requested a review from abr-egn July 8, 2026 03:02
@abr-egn

abr-egn commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Out of curiosity, is there a specific reason for rebasing onto that commit rather than the latest merged one? Still getting familiar with the testing setup here, so apologies if this is a naive question!

That was the one that fixed the tests is all, rebasing to latest would also have been fine 🙂

@abr-egn
abr-egn merged commit 7a3eb9b into mongodb:main Jul 8, 2026
17 of 19 checks passed
@OnjoujiToki

Copy link
Copy Markdown
Contributor Author

got it! thanks!

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