Skip to content

Commit 1bbf237

Browse files
cleanup
1 parent bd2c415 commit 1bbf237

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
sdam::{ServerType, TopologyVersion},
1919
};
2020

21-
pub use bulk_write::BulkWriteError;
21+
pub use bulk_write::{BulkWriteError, PartialBulkWriteResult};
2222

2323
const RECOVERING_CODES: [i32; 5] = [11600, 11602, 13436, 189, 91];
2424
const NOTWRITABLEPRIMARY_CODES: [i32; 3] = [10107, 13435, 10058];

src/results/bulk_write.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use crate::{
1414
#[non_exhaustive]
1515
pub struct SummaryBulkWriteResult {
1616
pub inserted_count: i64,
17-
pub upserted_count: i64,
1817
pub matched_count: i64,
1918
pub modified_count: i64,
19+
pub upserted_count: i64,
2020
pub deleted_count: i64,
2121
}
2222

@@ -27,9 +27,9 @@ pub struct SummaryBulkWriteResult {
2727
#[non_exhaustive]
2828
pub struct VerboseBulkWriteResult {
2929
pub inserted_count: i64,
30-
pub upserted_count: i64,
3130
pub matched_count: i64,
3231
pub modified_count: i64,
32+
pub upserted_count: i64,
3333
pub deleted_count: i64,
3434
#[cfg_attr(
3535
test,
@@ -59,8 +59,6 @@ mod result_trait {
5959

6060
fn merge(&mut self, other: Self);
6161

62-
fn empty_partial_result() -> PartialBulkWriteResult;
63-
6462
fn into_partial_result(self) -> PartialBulkWriteResult;
6563

6664
fn populate_summary_info(
@@ -90,23 +88,19 @@ impl BulkWriteResult for SummaryBulkWriteResult {
9088
fn merge(&mut self, other: Self) {
9189
let SummaryBulkWriteResult {
9290
inserted_count: other_inserted_count,
93-
upserted_count: other_upserted_count,
9491
matched_count: other_matched_count,
9592
modified_count: other_modified_count,
93+
upserted_count: other_upserted_count,
9694
deleted_count: other_deleted_count,
9795
} = other;
9896

9997
self.inserted_count += other_inserted_count;
100-
self.upserted_count += other_upserted_count;
10198
self.matched_count += other_matched_count;
10299
self.modified_count += other_modified_count;
100+
self.upserted_count += other_upserted_count;
103101
self.deleted_count += other_deleted_count;
104102
}
105103

106-
fn empty_partial_result() -> PartialBulkWriteResult {
107-
PartialBulkWriteResult::Summary(Default::default())
108-
}
109-
110104
fn into_partial_result(self) -> PartialBulkWriteResult {
111105
PartialBulkWriteResult::Summary(self)
112106
}
@@ -154,10 +148,6 @@ impl BulkWriteResult for VerboseBulkWriteResult {
154148
self.delete_results.extend(other_delete_results);
155149
}
156150

157-
fn empty_partial_result() -> PartialBulkWriteResult {
158-
PartialBulkWriteResult::Verbose(Default::default())
159-
}
160-
161151
fn into_partial_result(self) -> PartialBulkWriteResult {
162152
PartialBulkWriteResult::Verbose(self)
163153
}

0 commit comments

Comments
 (0)