From 2dab6d8364069d515066a6a9ab5b6fd7f3fa39eb Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 2 Dec 2020 17:06:46 -0600 Subject: [PATCH 1/2] [docs] Fix over-long monospacing of `SQLITE_BUSY` --- src/busy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/busy.rs b/src/busy.rs index fd46c74..32c2ab1 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -33,8 +33,8 @@ impl Connection { /// Register a callback to handle `SQLITE_BUSY` errors. /// - /// If the busy callback is `None`, then `SQLITE_BUSY is returned - /// immediately upon encountering the lock.` The argument to the busy + /// If the busy callback is `None`, then `SQLITE_BUSY` is returned + /// immediately upon encountering the lock. The argument to the busy /// handler callback is the number of times that the /// busy handler has been invoked previously for the /// same locking event. If the busy callback returns `false`, then no From 73754bbe242ad4878cee734e0cdc521ef56752c8 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 2 Dec 2020 17:10:15 -0600 Subject: [PATCH 2/2] [docs] Document default busy_timeout/busy_handler Include a note in the documentation for both `busy_handler()` and `busy_timeout()` explaining the current default behavior (with a disclaimer indicating that this behavior should not be relied upon as it is an implementation detail that may change). --- src/busy.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/busy.rs b/src/busy.rs index 32c2ab1..591e12e 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -21,6 +21,9 @@ impl Connection { /// connection at any given moment. If another busy handler was defined /// (using [`busy_handler`](Connection::busy_handler)) prior to calling this routine, that other /// busy handler is cleared. + /// + /// Newly created connections currently have a default busy timeout of 5000ms, but this may be + /// subject to change. pub fn busy_timeout(&self, timeout: Duration) -> Result<()> { let ms: i32 = timeout .as_secs() @@ -48,6 +51,9 @@ impl Connection { /// handler. Note that calling [`busy_timeout()`](Connection::busy_timeout) or evaluating `PRAGMA /// busy_timeout=N` will change the busy handler and thus /// clear any previously set busy handler. + /// + /// Newly created connections default to a [`busy_timeout()`](Connection::busy_timeout) handler + /// with a timeout of 5000ms, although this is subject to change. pub fn busy_handler(&self, callback: Option bool>) -> Result<()> { unsafe extern "C" fn busy_handler_callback(p_arg: *mut c_void, count: c_int) -> c_int { let handler_fn: fn(i32) -> bool = mem::transmute(p_arg);