32 lines
746 B
Rust
32 lines
746 B
Rust
use std::sync::Arc;
|
|
|
|
use actix::Addr;
|
|
use emgauwa_lib::errors::EmgauwaError;
|
|
use emgauwa_lib::models::Controller;
|
|
use tokio::sync::Notify;
|
|
|
|
use crate::app_state;
|
|
use crate::app_state::AppState;
|
|
|
|
pub async fn app_state_get_this(app_state: &Addr<AppState>) -> Result<Controller, EmgauwaError> {
|
|
app_state
|
|
.send(app_state::GetThis {})
|
|
.await
|
|
.map_err(EmgauwaError::from)
|
|
}
|
|
|
|
pub async fn app_state_get_notifier(
|
|
app_state: &Addr<AppState>,
|
|
) -> Result<Arc<Notify>, EmgauwaError> {
|
|
app_state
|
|
.send(app_state::GetNotifier {})
|
|
.await
|
|
.map_err(EmgauwaError::from)
|
|
}
|
|
|
|
pub async fn app_state_reload(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
|
|
app_state
|
|
.send(app_state::Reload {})
|
|
.await
|
|
.map_err(EmgauwaError::from)?
|
|
}
|