From 7c1b8bc9574f19b6ea3536155c13d55cf5dbee92 Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Wed, 25 Mar 2015 12:01:30 -0400 Subject: Change usage of `AsPath` to `AsRef`. RFC 529[1] has landed. [1] https://github.com/rust-lang/rfcs/pull/529 --- src/database.rs | 18 +++++++++--------- src/lib.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/database.rs b/src/database.rs index 7469bb0..9e0c001 100644 --- a/src/database.rs +++ b/src/database.rs @@ -24,8 +24,8 @@ pub struct Version(libc::c_uint); pub struct Database(*mut ffi::notmuch_database_t); impl Database { - pub fn create(path: &P) -> Result { - let path = path.as_path().to_cstring().unwrap(); + pub fn create>(path: &P) -> Result { + let path = path.as_ref().to_cstring().unwrap(); let mut db = ptr::null_mut(); try!(unsafe { @@ -35,8 +35,8 @@ impl Database { Ok(Database(db)) } - pub fn open(path: &P, mode: Mode) -> Result { - let path = path.as_path().to_cstring().unwrap(); + pub fn open>(path: &P, mode: Mode) -> Result { + let path = path.as_ref().to_cstring().unwrap(); let mut db = ptr::null_mut(); try!(unsafe { @@ -56,20 +56,20 @@ impl Database { Ok(()) } - pub fn compact( + pub fn compact, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, ) -> Result<()> { let status: Option = None; Database::_compact(path, backup_path, status) } - pub fn compact_with_status( + pub fn compact_with_status, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, status: F, ) -> Result<()> { Database::_compact(path, backup_path, Some(status)) } - fn _compact( + fn _compact, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, status: Option, ) -> Result<()> { @@ -82,9 +82,9 @@ impl Database { } } - let path = path.as_path().to_cstring().unwrap(); + let path = path.as_ref().to_cstring().unwrap(); let backup_path = backup_path.map(|p| { - p.as_path().to_cstring().unwrap() + p.as_ref().to_cstring().unwrap() }); try!(unsafe { diff --git a/src/lib.rs b/src/lib.rs index 0e3b871..91c4c5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(core, libc, std_misc)] +#![feature(convert, core, libc, std_misc, unsafe_destructor)] extern crate libc; #[macro_use] -- cgit v1.2.1