Add base data structures for pool matches
Some checks failed
Build Crate / build (push) Failing after 4m29s

This commit is contained in:
2023-09-22 03:45:48 -04:00
parent 0a68829d6c
commit 30f3aa63d5
16 changed files with 148 additions and 123 deletions

View File

@@ -1,3 +1,6 @@
// Not a page, global state that is shared between all pages
use crate::data::pool_match::PoolMatchList;
use perseus::{prelude::*, state::GlobalStateCreator};
use serde::{Deserialize, Serialize};
@@ -5,13 +8,10 @@ cfg_if::cfg_if! {
if #[cfg(engine)] {
use std::thread;
use std::ops::Deref;
use crate::data::store::DATA;
}
}
#[cfg(engine)]
use crate::data::store::DATA;
use crate::data::pool_match::PoolMatchList;
#[derive(Serialize, Deserialize, ReactiveState, Clone)]
#[rx(alias = "AppStateRx")]
pub struct AppState {
@@ -26,16 +26,13 @@ pub fn get_global_state_creator() -> GlobalStateCreator {
#[engine_only_fn]
fn get_state() -> AppState {
let matches = thread::spawn(move || {
DATA.lock().unwrap().deref().matches.clone()
}).join().unwrap();
let matches = thread::spawn(move || DATA.lock().unwrap().deref().matches.clone())
.join()
.unwrap();
AppState {
matches
}
AppState { matches }
}
#[engine_only_fn]
pub async fn get_build_state() -> AppState {
get_state()