diff --git a/src/database.rs b/src/database.rs index f03f6cb..38a010c 100644 --- a/src/database.rs +++ b/src/database.rs @@ -14,10 +14,10 @@ pub struct Database<'l> { impl<'l> Database<'l> { /// Open a connection to a new or existing database. - pub fn open(path: &Path) -> Result> { + pub fn open>(path: P) -> Result> { let mut raw = 0 as *mut _; unsafe { - success!(ffi::sqlite3_open_v2(path_to_c_str!(path), &mut raw, + success!(ffi::sqlite3_open_v2(path_to_c_str!(path.as_ref()), &mut raw, ffi::SQLITE_OPEN_CREATE | ffi::SQLITE_OPEN_READWRITE, 0 as *const _)); } diff --git a/src/lib.rs b/src/lib.rs index 24b3263..97d854d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,7 +99,7 @@ pub type Result = ::std::result::Result; /// Open a connection to a new or existing database. #[inline] -pub fn open<'l>(path: &std::path::Path) -> Result> { +pub fn open<'l, P: std::convert::AsRef>(path: P) -> Result> { Database::open(path) }