diff --git a/otg/core/src/library.rs b/otg/core/src/library.rs
index 135bb47..4fe5241 100644
--- a/otg/core/src/library.rs
+++ b/otg/core/src/library.rs
@@ -14,18 +14,18 @@ General Public License for more details.
You should have received a copy of the GNU General Public License along with On the Grid. If not, see .
*/
-use crate::{Core};
+use crate::Core;
use serde::{Deserialize, Serialize};
use sgf::GameRecord;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum LibraryRequest {
- ListGames
+ ListGames,
}
#[derive(Clone, Debug)]
pub enum LibraryResponse {
- Games(Vec)
+ Games(Vec),
}
async fn handle_list_games(model: &Core) -> LibraryResponse {
@@ -39,10 +39,8 @@ async fn handle_list_games(model: &Core) -> LibraryResponse {
}
}
-
pub async fn handle(model: &Core, request: LibraryRequest) -> LibraryResponse {
match request {
LibraryRequest::ListGames => handle_list_games(model).await,
}
}
-
diff --git a/otg/core/src/types.rs b/otg/core/src/types.rs
index 12153eb..fb1c364 100644
--- a/otg/core/src/types.rs
+++ b/otg/core/src/types.rs
@@ -3,7 +3,9 @@ use config::define_config;
use config_derive::ConfigOption;
use serde::{Deserialize, Serialize};
use sgf::GameTree;
-use std::{cell::RefCell, collections::VecDeque, fmt, path::PathBuf, time::Duration};
+use std::{
+ cell::RefCell, collections::{HashMap, VecDeque}, fmt, ops::Deref, path::PathBuf, time::Duration
+};
use thiserror::Error;
define_config! {
@@ -242,19 +244,39 @@ pub struct Tree {
struct DepthTree(slab_tree::Tree);
+impl Deref for DepthTree {
+ type Target = slab_tree::Tree;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
#[derive(Debug)]
pub struct SizeNode {
- pub id: usize,
node_id: slab_tree::NodeId,
- parent: Option,
+ parent: Option,
depth: usize,
- width: RefCell