-
Notifications
You must be signed in to change notification settings - Fork 181
RUST-1992 Update the driver for bson cstr API changes #1412
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
base: main
Are you sure you want to change the base?
Conversation
Cargo.toml
Outdated
@@ -136,6 +136,9 @@ version = "3.0.0" | |||
optional = true | |||
features = ["serde"] | |||
|
|||
[patch."https://github.com/mongodb/bson-rust"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove this once mongodb/bson-rust#571 is merged.
src/client/executor.rs
Outdated
@@ -320,10 +320,11 @@ impl Client { | |||
.and_then(|s| s.transaction.pinned_mongos()) | |||
.or_else(|| op.selection_criteria()); | |||
|
|||
let op_name: &str = op.name().into(); |
There was a problem hiding this comment.
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)
@@ -108,7 +109,7 @@ pub(crate) trait Operation { | |||
type O; | |||
|
|||
/// The name of the server side command associated with this operation. | |||
const NAME: &'static str; | |||
const NAME: &'static CStr; |
There was a problem hiding this comment.
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.
RUST-1992
This involved unwinding all the fallibility I'd introduced in #1401, and introducing a compatibility layer for
CStr
that redirects to plainstr
for bson 2.x.