pub struct AppState {
pub settings: Arc<Settings>,
pub conn: Arc<Mutex<Connection>>,
}Expand description
Application state shared by every route. The single SQLite connection
is wrapped in a Mutex since rusqlite is sync-only; handlers acquire
the lock briefly. For long-running queries we’d spawn_blocking, but
the workload here is microsecond-scale.
Fields§
§settings: Arc<Settings>§conn: Arc<Mutex<Connection>>Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more