pub struct AppState {
pub db: Arc<Mutex<Database>>,
pub sse_tx: Sender<SseEvent>,
/* private fields */
}Expand description
Shared argument state
Fields§
§db: Arc<Mutex<Database>>Database connection wrapped for async access
sse_tx: Sender<SseEvent>Broadcast channel for SSE events
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn from_database(db: Database) -> Self
pub fn from_database(db: Database) -> Self
Create application state backed by an existing database (for tests).
Sourcepub async fn start_change_detection(&self)
pub async fn start_change_detection(&self)
Start background task to detect database changes
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin 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