common/emgauwa-controller/src/utils.rs

10 lines
290 B
Rust
Raw Normal View History

use actix::Addr;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::Controller;
use crate::app_state::{AppState, GetThis};
pub async fn get_this(app_state: &Addr<AppState>) -> Result<Controller, EmgauwaError> {
app_state.send(GetThis {}).await.map_err(EmgauwaError::from)
}