RUST-1858 Add builders for bulk write models#1104
Merged
isabelatkinson merged 1 commit intomongodb:mainfrom May 16, 2024
Merged
RUST-1858 Add builders for bulk write models#1104isabelatkinson merged 1 commit intomongodb:mainfrom
isabelatkinson merged 1 commit intomongodb:mainfrom
Conversation
isabelatkinson
commented
May 15, 2024
Comment on lines
+22
to
+25
| let mut models_vec = Vec::new(); | ||
| for model in models.into_iter() { | ||
| models_vec.push(model.into()); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
I think models.into_iter().map(Into::into).collect() will do two passes, did a manual impl here to be safe
| @@ -32,66 +36,205 @@ pub struct BulkWriteOptions { | |||
| #[serde(untagged)] | |||
| #[non_exhaustive] | |||
| pub enum WriteModel { | |||
Contributor
Author
There was a problem hiding this comment.
TypedBuilder doesn't work for enums with directly-embedded fields
abr-egn
reviewed
May 16, 2024
| @@ -31,136 +38,22 @@ impl<'de> Deserialize<'de> for WriteModel { | |||
| #[derive(Debug, Deserialize)] | |||
| #[serde(rename_all = "camelCase")] | |||
| enum WriteModelHelper { | |||
Contributor
There was a problem hiding this comment.
Is this impl still needed? This looks equivalent to what I think #[derive(Deserialize)] on WriteModel would produce now.
Contributor
Author
There was a problem hiding this comment.
this limitation still holds unfortunately, the test files use a "tagged" representation whereas the ops array doesn't
abr-egn
approved these changes
May 16, 2024
8f15330 to
0366337
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also has the changes from #1103, filtering by the last commit will show the relevant changes for this PR.