Allow mixed usage of strings and slices in get_collection

pull/9/head
Thijs Cadier 9 years ago
parent 0b61492889
commit ddd01a78e4

@ -204,7 +204,7 @@ pub struct Client<'a> {
}
impl<'a> Client<'a> {
pub fn get_collection<S: Into<Vec<u8>>>(&'a self, db: S, collection: S) -> Collection<'a> {
pub fn get_collection<DBT: Into<Vec<u8>>, CT: Into<Vec<u8>>>(&'a self, db: DBT, collection: CT) -> Collection<'a> {
assert!(!self.inner.is_null());
let coll = unsafe {
let db_cstring = CString::new(db).unwrap();

@ -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(());

Loading…
Cancel
Save