From ddd01a78e44703cc290ea42ef2ba4355023b6fbf Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Fri, 28 Aug 2015 11:56:08 +0200 Subject: [PATCH] Allow mixed usage of strings and slices in get_collection --- src/client.rs | 2 +- tests/collection.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 8532762..5470983 100644 --- a/src/client.rs +++ b/src/client.rs @@ -204,7 +204,7 @@ pub struct Client<'a> { } impl<'a> Client<'a> { - pub fn get_collection>>(&'a self, db: S, collection: S) -> Collection<'a> { + pub fn get_collection>, CT: Into>>(&'a self, db: DBT, collection: CT) -> Collection<'a> { assert!(!self.inner.is_null()); let coll = unsafe { let db_cstring = CString::new(db).unwrap(); diff --git a/tests/collection.rs b/tests/collection.rs index 0414f35..51ca2f0 100644 --- a/tests/collection.rs +++ b/tests/collection.rs @@ -23,6 +23,7 @@ fn test_mutation_and_finding() { let uri = Uri::new("mongodb://localhost:27017/").unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); + let _ = client.get_collection("rust_driver_test".to_string(), "items"); let mut collection = client.get_collection("rust_driver_test", "items"); collection.drop().unwrap_or(());