Skip to content

Conversation

@abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Jul 8, 2025

RUST-1992

This involved unwinding all the fallibility I'd introduced in #1401, and introducing a compatibility layer for CStr that redirects to plain str for bson 2.x.

.and_then(|s| s.transaction.pinned_mongos())
.or_else(|| op.selection_criteria());

let op_name: &str = op.name().into();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

op.name().as_str() would be the easier way to spell this but unfortunately that doesn't compile for bson 2.x when op.name() is a str itself because str::as_str isn't stabilized yet 😞 (rust-lang/rust#130366)


/// The name of the server side command associated with this operation.
const NAME: &'static str;
const NAME: &'static CStr;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the large majority of cases, NAME is primarily used as a key in rawdoc! construction.

@abr-egn abr-egn marked this pull request as ready for review July 14, 2025 11:52
@abr-egn abr-egn requested a review from a team as a code owner July 14, 2025 11:52
@abr-egn abr-egn requested a review from isabelatkinson July 14, 2025 11:52
@abr-egn abr-egn merged commit a38c035 into mongodb:main Jul 14, 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