Skip to content
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

RUST-1175 Support zero-copy deserialization from cursors #579

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/bson_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ pub(crate) fn get_u64(val: &Bson) -> Option<u64> {
}
}

pub(crate) fn get_u64_raw(val: RawBsonRef<'_>) -> Option<u64> {
match val {
RawBsonRef::Int32(i) => get_u64(&Bson::Int32(i)),
RawBsonRef::Int64(i) => get_u64(&Bson::Int64(i)),
RawBsonRef::Double(i) => get_u64(&Bson::Double(i)),
_ => None,
}
}

pub(crate) fn to_bson_array(docs: &[Document]) -> Bson {
Bson::Array(docs.iter().map(|doc| Bson::Document(doc.clone())).collect())
}
Expand Down
2 changes: 0 additions & 2 deletions src/client/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ impl Client {
pub(crate) async fn execute_cursor_operation<Op, T>(&self, op: Op) -> Result<Cursor<T>>
where
Op: Operation<O = CursorSpecification>,
T: DeserializeOwned + Unpin + Send + Sync,
{
Box::pin(async {
let mut details = self.execute_operation_with_details(op, None).await?;
Expand All @@ -173,7 +172,6 @@ impl Client {
) -> Result<SessionCursor<T>>
where
Op: Operation<O = CursorSpecification>,
T: DeserializeOwned + Unpin + Send + Sync,
{
let mut details = self
.execute_operation_with_details(op, &mut *session)
Expand Down
10 changes: 5 additions & 5 deletions src/coll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,12 +849,7 @@ impl<T> Collection<T> {
.execute_watch_with_session(pipeline, options, target, None, session)
.await
}
}

impl<T> Collection<T>
where
T: DeserializeOwned + Unpin + Send + Sync,
{
/// Finds the documents in the collection matching `filter`.
pub async fn find(
&self,
Expand Down Expand Up @@ -886,7 +881,12 @@ where

client.execute_session_cursor_operation(find, session).await
}
}

impl<T> Collection<T>
where
T: DeserializeOwned + Unpin + Send + Sync,
{
/// Finds a single document in the collection matching `filter`.
pub async fn find_one(
&self,
Expand Down
Loading