Skip to content

RUST-1992 Driver changes to track bson serde-optional API changes #1401

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

Merged
merged 7 commits into from
Jun 23, 2025

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Jun 18, 2025

RUST-1992

An awful lot of search and replace here; the only real substance is in the bson_compat module.

use crate::bson::RawBson;

pub(crate) trait RawDocumentBufExt: Sized {
fn append_err(&mut self, key: impl AsRef<str>, value: impl Into<RawBson>) -> RawResult<()>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since append and similar are now fallible in 3.0, the compatibility layer needed to make them fallible (at least at the type level) for 2.x as well, even if they never actually fail. The other option would be to wrap the 3.x variants in expect but this way people opting in to bson-3 get nicer error behavior as a bonus :)

}
}

macro_rules! use_either {
Copy link
Contributor Author

@abr-egn abr-egn Jun 18, 2025

Choose a reason for hiding this comment

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

I know this is kind of a frivolous use of a macro but I got real tired of writing these out by hand and I find the tabular format a lot easier to read. I can revert if you feel strongly :)

@abr-egn abr-egn marked this pull request as ready for review June 20, 2025 18:23
@abr-egn abr-egn requested a review from a team as a code owner June 20, 2025 18:23
@abr-egn abr-egn requested a review from isabelatkinson June 20, 2025 18:23
@abr-egn abr-egn merged commit 0f6a690 into mongodb:main Jun 23, 2025
18 checks passed
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