Skip to content

Commit 7029790

Browse files
Allow passing owned Vector to doc macro (#524)
1 parent a3ceaf3 commit 7029790

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/binary/vector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ impl TryFrom<Binary> for Vector {
246246
}
247247
}
248248

249-
// Convenience impl to allow passing a Vector directly into the doc! macro. From<Vector> is already
249+
// Convenience impl to allow passing a Vector directly into the doc! macro. From<&Vector> is already
250250
// implemented by a blanket impl in src/bson.rs.
251-
impl From<&Vector> for Bson {
252-
fn from(vector: &Vector) -> Self {
251+
impl From<Vector> for Bson {
252+
fn from(vector: Vector) -> Self {
253253
Self::Binary(Binary::from(vector))
254254
}
255255
}

src/tests/spec/vector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ fn run_test_file(test_file: TestFile) {
170170
// From<Vector> for Bson
171171
let document = doc! { "vector": &test_vector };
172172
assert_eq!(document, test_document);
173+
let document = doc! { "vector": test_vector.clone() };
174+
assert_eq!(document, test_document);
173175

174176
// From<Vector> for RawBson
175177
let raw_document = rawdoc! { "vector": &test_vector };

0 commit comments

Comments
 (0)