diff --git a/src/hooks.rs b/src/hooks.rs index e7d2670..0366b5f 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -42,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>, } @@ -254,7 +254,7 @@ impl<'c> AuthAction<'c> { table_name, column_name, }, - (ffi::SQLITE_SELECT, _, _) => Self::Select, + (ffi::SQLITE_SELECT, ..) => Self::Select, (ffi::SQLITE_TRANSACTION, Some(operation_str), _) => Self::Transaction { operation: TransactionOperation::from_str(operation_str), }, @@ -286,7 +286,7 @@ impl<'c> AuthAction<'c> { savepoint_name, }, #[cfg(feature = "modern_sqlite")] - (ffi::SQLITE_RECURSIVE, _, _) => Self::Recursive, + (ffi::SQLITE_RECURSIVE, ..) => Self::Recursive, (code, arg1, arg2) => Self::Unknown { code, arg1, arg2 }, } } @@ -298,6 +298,7 @@ pub(crate) type BoxedAuthorizer = /// `feature = "hooks"` A transaction operation. #[derive(Clone, Copy, Debug, PartialEq)] #[non_exhaustive] +#[allow(missing_docs)] pub enum TransactionOperation { Unknown, Begin, @@ -316,6 +317,7 @@ impl TransactionOperation { } } +/// [`authorizer`](Connection::authorizer) return code #[derive(Clone, Copy, Debug, PartialEq)] #[non_exhaustive] pub enum Authorization { @@ -597,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/lib.rs b/src/lib.rs index 71a4759..61dc96f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,8 +73,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}; @@ -102,7 +100,7 @@ mod context; #[cfg(feature = "functions")] pub mod functions; #[cfg(feature = "hooks")] -mod hooks; +pub mod hooks; mod inner_connection; #[cfg(feature = "limits")] pub mod limits;