mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
Merge branch 'uasi-open-takes-asref-path'
This commit is contained in:
commit
e1be1eb3fd
@ -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<Database<'l>> {
|
||||
pub fn open<P: AsRef<Path>>(path: P) -> Result<Database<'l>> {
|
||||
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 _));
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
|
||||
/// Open a connection to a new or existing database.
|
||||
#[inline]
|
||||
pub fn open<'l>(path: &std::path::Path) -> Result<Database<'l>> {
|
||||
pub fn open<'l, P: std::convert::AsRef<std::path::Path>>(path: P) -> Result<Database<'l>> {
|
||||
Database::open(path)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user