diff --git a/src/blob/mod.rs b/src/blob/mod.rs index 7b89647..2b13e1d 100644 --- a/src/blob/mod.rs +++ b/src/blob/mod.rs @@ -223,7 +223,7 @@ impl Connection { row_id: i64, read_only: bool, ) -> Result> { - let mut c = self.db.borrow_mut(); + let c = self.db.borrow_mut(); let mut blob = ptr::null_mut(); let db = db.as_cstring()?; let table = super::str_to_cstring(table)?; diff --git a/src/busy.rs b/src/busy.rs index e51fb08..b394d01 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -64,7 +64,7 @@ impl Connection { 0 } } - let mut c = self.db.borrow_mut(); + let c = self.db.borrow_mut(); let r = match callback { Some(f) => unsafe { ffi::sqlite3_busy_handler(c.db(), Some(busy_handler_callback), f as *mut c_void) diff --git a/src/hooks.rs b/src/hooks.rs index 943e1ea..1c9dbdf 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -14,7 +14,6 @@ use crate::{Connection, InnerConnection}; #[repr(i32)] #[non_exhaustive] #[allow(clippy::upper_case_acronyms)] -#[cfg_attr(docsrs, doc(cfg(feature = "hooks")))] pub enum Action { /// Unsupported / unexpected action UNKNOWN = -1, @@ -43,14 +42,14 @@ impl From for Action { /// See for more info. #[derive(Clone, Copy, Debug, PartialEq)] pub struct AuthContext<'c> { - // The action to be authorized. + /// The action to be authorized. pub action: AuthAction<'c>, /// The database name, if applicable. pub database_name: Option<&'c str>, - // The inner-most trigger or view responsible for the access attempt. - // `None` if the access attempt was made by top-level SQL code. + /// The inner-most trigger or view responsible for the access attempt. + /// `None` if the access attempt was made by top-level SQL code. pub accessor: Option<&'c str>, } @@ -299,6 +298,7 @@ pub(crate) type BoxedAuthorizer = /// A transaction operation. #[derive(Clone, Copy, Debug, PartialEq)] #[non_exhaustive] +#[allow(missing_docs)] pub enum TransactionOperation { Unknown, Begin, @@ -317,6 +317,7 @@ impl TransactionOperation { } } +/// [`authorizer`](Connection::authorizer) return code #[derive(Clone, Copy, Debug, PartialEq)] #[non_exhaustive] pub enum Authorization { @@ -598,7 +599,7 @@ impl InnerConnection { }; } - pub fn authorizer<'c, F>(&'c mut self, authorizer: Option) + fn authorizer<'c, F>(&'c mut self, authorizer: Option) where F: for<'r> FnMut(AuthContext<'r>) -> Authorization + Send + RefUnwindSafe + 'static, { diff --git a/src/inner_connection.rs b/src/inner_connection.rs index 11dc524..1bd641c 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -136,7 +136,7 @@ impl InnerConnection { } #[inline] - pub fn decode_result(&mut self, code: c_int) -> Result<()> { + pub fn decode_result(&self, code: c_int) -> Result<()> { unsafe { InnerConnection::decode_result_raw(self.db(), code) } } @@ -278,7 +278,7 @@ impl InnerConnection { } #[inline] - pub fn changes(&mut self) -> usize { + pub fn changes(&self) -> usize { unsafe { ffi::sqlite3_changes(self.db()) as usize } } diff --git a/src/lib.rs b/src/lib.rs index 18e2723..f82f9e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,8 +74,6 @@ pub use crate::cache::CachedStatement; pub use crate::column::Column; pub use crate::error::Error; pub use crate::ffi::ErrorCode; -#[cfg(feature = "hooks")] -pub use crate::hooks::Action; #[cfg(feature = "load_extension")] pub use crate::load_extension_guard::LoadExtensionGuard; pub use crate::params::{params_from_iter, Params, ParamsFromIter}; @@ -108,7 +106,7 @@ mod context; pub mod functions; #[cfg(feature = "hooks")] #[cfg_attr(docsrs, doc(cfg(feature = "hooks")))] -mod hooks; +pub mod hooks; mod inner_connection; #[cfg(feature = "limits")] #[cfg_attr(docsrs, doc(cfg(feature = "limits")))] @@ -845,7 +843,7 @@ impl Connection { #[inline] fn decode_result(&self, code: c_int) -> Result<()> { - self.db.borrow_mut().decode_result(code) + self.db.borrow().decode_result(code) } /// Return the number of rows modified, inserted or deleted by the most @@ -853,7 +851,7 @@ impl Connection { /// connection. #[inline] fn changes(&self) -> usize { - self.db.borrow_mut().changes() + self.db.borrow().changes() } /// Test for auto-commit mode.