diff options
| author | C. Morgan Hamill <me@cmhamill.org> | 2015-03-25 17:01:30 +0100 |
|---|---|---|
| committer | C. Morgan Hamill <me@cmhamill.org> | 2015-03-25 17:01:30 +0100 |
| commit | 7c1b8bc9574f19b6ea3536155c13d55cf5dbee92 (patch) | |
| tree | 5626cb5876338e5306dd7c8ed5293721fbf2b9ff | |
| parent | 0c55e4e4d5bb8b9098fc6f780a74e99f436153c0 (diff) | |
| download | mail-7c1b8bc9574f19b6ea3536155c13d55cf5dbee92.tar.gz | |
Change usage of `AsPath` to `AsRef<Path>`.
RFC 529[1] has landed.
[1] https://github.com/rust-lang/rfcs/pull/529
| -rw-r--r-- | src/database.rs | 18 | ||||
| -rw-r--r-- | src/lib.rs | 2 |
2 files changed, 10 insertions, 10 deletions
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<P: path::AsPath>(path: &P) -> Result<Database> { - let path = path.as_path().to_cstring().unwrap(); + pub fn create<P: AsRef<path::Path>>(path: &P) -> Result<Database> { + 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<P: path::AsPath>(path: &P, mode: Mode) -> Result<Database> { - let path = path.as_path().to_cstring().unwrap(); + pub fn open<P: AsRef<path::Path>>(path: &P, mode: Mode) -> Result<Database> { + 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<P: path::AsPath, F: FnMut(&str)>( + pub fn compact<P: AsRef<path::Path>, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, ) -> Result<()> { let status: Option<F> = None; Database::_compact(path, backup_path, status) } - pub fn compact_with_status<P: path::AsPath, F: FnMut(&str)>( + pub fn compact_with_status<P: AsRef<path::Path>, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, status: F, ) -> Result<()> { Database::_compact(path, backup_path, Some(status)) } - fn _compact<P: path::AsPath, F: FnMut(&str)>( + fn _compact<P: AsRef<path::Path>, F: FnMut(&str)>( path: &P, backup_path: Option<&P>, status: Option<F>, ) -> 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 { @@ -1,4 +1,4 @@ -#![feature(core, libc, std_misc)] +#![feature(convert, core, libc, std_misc, unsafe_destructor)] extern crate libc; #[macro_use] |
