Set up the core run loop
This commit is contained in:
parent
f2cca31310
commit
9b58770070
|
@ -11,11 +11,12 @@ pub enum Request {
|
||||||
PlayingField,
|
PlayingField,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum Response {
|
pub enum Response {
|
||||||
PlayingFieldView(PlayingFieldView),
|
PlayingFieldView(PlayingFieldView),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn disptach(state: Arc<RwLock<AppState>>, request: Request) -> Response {
|
fn dispatch(state: Arc<RwLock<AppState>>, request: Request) -> Response {
|
||||||
match request {
|
match request {
|
||||||
Request::PlayingField => Response::PlayingFieldView(playing_field()),
|
Request::PlayingField => Response::PlayingFieldView(playing_field()),
|
||||||
}
|
}
|
||||||
|
@ -45,8 +46,11 @@ impl CoreApp {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run(&self) {
|
pub async fn run(&mut self) {
|
||||||
thread::sleep(Duration::from_secs(5));
|
loop {
|
||||||
unimplemented!()
|
let msg = self.request_rx.recv().await.unwrap();
|
||||||
|
let resp = dispatch(self.state.clone(), msg);
|
||||||
|
self.response_tx.send(resp).await.unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue