Skip to content

Commit 8e07cf4

Browse files
authored
RUST-1175 Support zero-copy deserialization from cursors (#579)
1 parent 187b361 commit 8e07cf4

File tree

19 files changed

+896
-550
lines changed

19 files changed

+896
-550
lines changed

src/bson_util/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ pub(crate) fn get_u64(val: &Bson) -> Option<u64> {
4242
}
4343
}
4444

45-
pub(crate) fn get_u64_raw(val: RawBsonRef<'_>) -> Option<u64> {
46-
match val {
47-
RawBsonRef::Int32(i) => get_u64(&Bson::Int32(i)),
48-
RawBsonRef::Int64(i) => get_u64(&Bson::Int64(i)),
49-
RawBsonRef::Double(i) => get_u64(&Bson::Double(i)),
50-
_ => None,
51-
}
52-
}
53-
5445
pub(crate) fn to_bson_array(docs: &[Document]) -> Bson {
5546
Bson::Array(docs.iter().map(|doc| Bson::Document(doc.clone())).collect())
5647
}

src/client/executor.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ impl Client {
148148
pub(crate) async fn execute_cursor_operation<Op, T>(&self, op: Op) -> Result<Cursor<T>>
149149
where
150150
Op: Operation<O = CursorSpecification>,
151-
T: DeserializeOwned + Unpin + Send + Sync,
152151
{
153152
Box::pin(async {
154153
let mut details = self.execute_operation_with_details(op, None).await?;
@@ -173,7 +172,6 @@ impl Client {
173172
) -> Result<SessionCursor<T>>
174173
where
175174
Op: Operation<O = CursorSpecification>,
176-
T: DeserializeOwned + Unpin + Send + Sync,
177175
{
178176
let mut details = self
179177
.execute_operation_with_details(op, &mut *session)

src/coll/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,12 +849,7 @@ impl<T> Collection<T> {
849849
.execute_watch_with_session(pipeline, options, target, None, session)
850850
.await
851851
}
852-
}
853852

854-
impl<T> Collection<T>
855-
where
856-
T: DeserializeOwned + Unpin + Send + Sync,
857-
{
858853
/// Finds the documents in the collection matching `filter`.
859854
pub async fn find(
860855
&self,
@@ -886,7 +881,12 @@ where
886881

887882
client.execute_session_cursor_operation(find, session).await
888883
}
884+
}
889885

886+
impl<T> Collection<T>
887+
where
888+
T: DeserializeOwned + Unpin + Send + Sync,
889+
{
890890
/// Finds a single document in the collection matching `filter`.
891891
pub async fn find_one(
892892
&self,

0 commit comments

Comments
 (0)