Skip to content

Commit 7c1b8bc

Browse files
committed
Change usage of AsPath to AsRef<Path>.
RFC 529[1] has landed. [1] rust-lang/rfcs#529
1 parent 0c55e4e commit 7c1b8bc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/database.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub struct Version(libc::c_uint);
2424
pub struct Database(*mut ffi::notmuch_database_t);
2525

2626
impl Database {
27-
pub fn create<P: path::AsPath>(path: &P) -> Result<Database> {
28-
let path = path.as_path().to_cstring().unwrap();
27+
pub fn create<P: AsRef<path::Path>>(path: &P) -> Result<Database> {
28+
let path = path.as_ref().to_cstring().unwrap();
2929

3030
let mut db = ptr::null_mut();
3131
try!(unsafe {
@@ -35,8 +35,8 @@ impl Database {
3535
Ok(Database(db))
3636
}
3737

38-
pub fn open<P: path::AsPath>(path: &P, mode: Mode) -> Result<Database> {
39-
let path = path.as_path().to_cstring().unwrap();
38+
pub fn open<P: AsRef<path::Path>>(path: &P, mode: Mode) -> Result<Database> {
39+
let path = path.as_ref().to_cstring().unwrap();
4040

4141
let mut db = ptr::null_mut();
4242
try!(unsafe {
@@ -56,20 +56,20 @@ impl Database {
5656
Ok(())
5757
}
5858

59-
pub fn compact<P: path::AsPath, F: FnMut(&str)>(
59+
pub fn compact<P: AsRef<path::Path>, F: FnMut(&str)>(
6060
path: &P, backup_path: Option<&P>,
6161
) -> Result<()> {
6262
let status: Option<F> = None;
6363
Database::_compact(path, backup_path, status)
6464
}
6565

66-
pub fn compact_with_status<P: path::AsPath, F: FnMut(&str)>(
66+
pub fn compact_with_status<P: AsRef<path::Path>, F: FnMut(&str)>(
6767
path: &P, backup_path: Option<&P>, status: F,
6868
) -> Result<()> {
6969
Database::_compact(path, backup_path, Some(status))
7070
}
7171

72-
fn _compact<P: path::AsPath, F: FnMut(&str)>(
72+
fn _compact<P: AsRef<path::Path>, F: FnMut(&str)>(
7373
path: &P, backup_path: Option<&P>, status: Option<F>,
7474
) -> Result<()> {
7575

@@ -82,9 +82,9 @@ impl Database {
8282
}
8383
}
8484

85-
let path = path.as_path().to_cstring().unwrap();
85+
let path = path.as_ref().to_cstring().unwrap();
8686
let backup_path = backup_path.map(|p| {
87-
p.as_path().to_cstring().unwrap()
87+
p.as_ref().to_cstring().unwrap()
8888
});
8989

9090
try!(unsafe {

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(core, libc, std_misc)]
1+
#![feature(convert, core, libc, std_misc, unsafe_destructor)]
22
extern crate libc;
33

44
#[macro_use]

0 commit comments

Comments
 (0)