From 18ea605451f38f334303dc64de6665c1151eb5b5 Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Sat, 1 Aug 2015 15:14:10 -0400 Subject: [PATCH] Get rid of the livetime parameter of Connection --- src/connection.rs | 14 +++++++------- src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/connection.rs b/src/connection.rs index 7239557..c5b4a16 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -6,15 +6,15 @@ use std::path::Path; use {Result, Statement}; /// A connection to a database. -pub struct Connection<'l> { +pub struct Connection { raw: *mut ffi::sqlite3, - busy_callback: Option bool + 'l>>, + busy_callback: Option bool>>, phantom: PhantomData, } -impl<'l> Connection<'l> { +impl Connection { /// Open a connection to a new or existing database. - pub fn open>(path: T) -> Result> { + pub fn open>(path: T) -> Result { let mut raw = 0 as *mut _; unsafe { ok!(ffi::sqlite3_open_v2(path_to_cstr!(path.as_ref()).as_ptr(), &mut raw, @@ -55,7 +55,7 @@ impl<'l> Connection<'l> { /// Create a prepared statement. #[inline] - pub fn prepare>(&'l self, query: T) -> Result> { + pub fn prepare<'l, T: AsRef>(&'l self, query: T) -> Result> { ::statement::new(self.raw, query) } @@ -65,7 +65,7 @@ impl<'l> Connection<'l> { /// due to processing of some other request. If the callback returns `true`, /// the operation will be repeated. pub fn set_busy_handler(&mut self, callback: F) -> Result<()> - where F: FnMut(usize) -> bool + 'l + where F: FnMut(usize) -> bool + 'static { try!(self.remove_busy_handler()); unsafe { @@ -95,7 +95,7 @@ impl<'l> Connection<'l> { } } -impl<'l> Drop for Connection<'l> { +impl Drop for Connection { #[cfg(not(feature = "sqlite3-close-v2"))] #[inline] #[allow(unused_must_use)] diff --git a/src/lib.rs b/src/lib.rs index 4388370..1690d8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,6 +111,6 @@ pub type Result = std::result::Result; /// Open a connection to a new or existing database. #[inline] -pub fn open<'l, T: AsRef>(path: T) -> Result> { +pub fn open>(path: T) -> Result { Connection::open(path) }