Skip to content

Commit d8eda15

Browse files
RUST-852 Move Collection generic trait bounds to implementation (#379)
1 parent 9da94ab commit d8eda15

File tree

8 files changed

+420
-342
lines changed

8 files changed

+420
-342
lines changed

Diff for: src/coll/mod.rs

+197-184
Large diffs are not rendered by default.

Diff for: src/db/mod.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pub mod options;
33
use std::{fmt::Debug, sync::Arc};
44

55
use futures_util::stream::TryStreamExt;
6-
use serde::{de::DeserializeOwned, Serialize};
76

87
use crate::{
98
bson::{Bson, Document},
@@ -137,10 +136,7 @@ impl Database {
137136
///
138137
/// This method does not send or receive anything across the wire to the database, so it can be
139138
/// used repeatedly without incurring any costs from I/O.
140-
pub fn collection<T>(&self, name: &str) -> Collection<T>
141-
where
142-
T: Serialize + DeserializeOwned + Unpin + Debug,
143-
{
139+
pub fn collection<T>(&self, name: &str) -> Collection<T> {
144140
Collection::new(self.clone(), name, None)
145141
}
146142

@@ -154,10 +150,7 @@ impl Database {
154150
&self,
155151
name: &str,
156152
options: CollectionOptions,
157-
) -> Collection<T>
158-
where
159-
T: Serialize + DeserializeOwned + Unpin + Debug,
160-
{
153+
) -> Collection<T> {
161154
Collection::new(self.clone(), name, Some(options))
162155
}
163156

Diff for: src/operation/find_and_modify/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod test;
44

55
use std::fmt::Debug;
66

7-
use serde::{de::DeserializeOwned, Deserialize, Serialize};
7+
use serde::{de::DeserializeOwned, Deserialize};
88

99
use self::options::FindAndModifyOptions;
1010
use crate::{
@@ -27,7 +27,7 @@ use crate::{
2727

2828
pub(crate) struct FindAndModify<T = Document>
2929
where
30-
T: Serialize + DeserializeOwned + Unpin + Debug,
30+
T: DeserializeOwned,
3131
{
3232
ns: Namespace,
3333
query: Document,
@@ -37,7 +37,7 @@ where
3737

3838
impl<T> FindAndModify<T>
3939
where
40-
T: Serialize + DeserializeOwned + Unpin + Debug,
40+
T: DeserializeOwned,
4141
{
4242
pub fn with_delete(
4343
ns: Namespace,
@@ -97,7 +97,7 @@ where
9797

9898
impl<T> Operation for FindAndModify<T>
9999
where
100-
T: Serialize + DeserializeOwned + Unpin + Debug,
100+
T: DeserializeOwned,
101101
{
102102
type O = Option<T>;
103103
const NAME: &'static str = "findAndModify";

Diff for: src/operation/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub(crate) use update::Update;
6060
/// A trait modeling the behavior of a server side operation.
6161
pub(crate) trait Operation {
6262
/// The output type of this operation.
63-
type O: Debug;
63+
type O;
6464

6565
/// The name of the server side command associated with this operation.
6666
const NAME: &'static str;

0 commit comments

Comments
 (0)