This commit is contained in:
phiresky 2020-12-18 13:54:38 +01:00
parent 1309c563c7
commit d4f8242d0c

View File

@ -53,13 +53,13 @@
//! } //! }
//! ``` //! ```
use std::any::Any; use std::any::Any;
use std::marker::PhantomData;
use std::ops::Deref;
use std::os::raw::{c_int, c_void}; use std::os::raw::{c_int, c_void};
use std::panic::{catch_unwind, RefUnwindSafe, UnwindSafe}; use std::panic::{catch_unwind, RefUnwindSafe, UnwindSafe};
use std::ptr; use std::ptr;
use std::slice; use std::slice;
use std::sync::Arc; use std::sync::Arc;
use std::marker::PhantomData;
use std::ops::Deref;
use crate::ffi; use crate::ffi;
use crate::ffi::sqlite3_context; use crate::ffi::sqlite3_context;
@ -223,7 +223,6 @@ impl Context<'_> {
} }
} }
/// Get the db connection handle via sqlite3_context_db_handle /// Get the db connection handle via sqlite3_context_db_handle
/// https://www.sqlite.org/c3ref/context_db_handle.html /// https://www.sqlite.org/c3ref/context_db_handle.html
/// ///
@ -234,14 +233,14 @@ impl Context<'_> {
let handle = ffi::sqlite3_context_db_handle(self.ctx); let handle = ffi::sqlite3_context_db_handle(self.ctx);
Ok(ConnectionRef { Ok(ConnectionRef {
conn: Connection::from_handle(handle)?, conn: Connection::from_handle(handle)?,
phantom: PhantomData phantom: PhantomData,
}) })
} }
} }
/// A reference to a connection handle with a lifetime bound to something. /// A reference to a connection handle with a lifetime bound to something.
pub struct ConnectionRef<'ctx> { pub struct ConnectionRef<'ctx> {
// comes from Connection::from_handle(sqlite3_context_db_handle(...)) // comes from Connection::from_handle(sqlite3_context_db_handle(...))
// and is non-owning // and is non-owning
conn: Connection, conn: Connection,
phantom: PhantomData<&'ctx Context<'ctx>>, phantom: PhantomData<&'ctx Context<'ctx>>,
@ -256,9 +255,6 @@ impl Deref for ConnectionRef<'_> {
} }
} }
type AuxInner = Arc<dyn Any + Send + Sync + 'static>; type AuxInner = Arc<dyn Any + Send + Sync + 'static>;
/// `feature = "functions"` Aggregate is the callback interface for user-defined /// `feature = "functions"` Aggregate is the callback interface for user-defined