diff --git a/Cargo.lock b/Cargo.lock index 484471d..2c96a1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2232,7 +2232,6 @@ dependencies = [ "serde_json", "sgf", "thiserror", - "typeshare", ] [[package]] diff --git a/kifu/core/Cargo.toml b/kifu/core/Cargo.toml index f4e0fdd..f98837d 100644 --- a/kifu/core/Cargo.toml +++ b/kifu/core/Cargo.toml @@ -15,7 +15,6 @@ grid = { version = "0.9" } serde_json = { version = "1" } serde = { version = "1", features = [ "derive" ] } thiserror = { version = "1" } -typeshare = { version = "1" } [dev-dependencies] cool_asserts = { version = "2" } diff --git a/kifu/core/src/api.rs b/kifu/core/src/api.rs index f96bb8c..a665c6e 100644 --- a/kifu/core/src/api.rs +++ b/kifu/core/src/api.rs @@ -1,15 +1,15 @@ use crate::{ - database::Database, types::{AppState, Config, ConfigOption, DatabasePath, GameState, Player, Rank}, ui::{configuration, home, playing_field, ConfigurationView, HomeView, PlayingFieldView} + database::Database, + types::{AppState, Config, ConfigOption, DatabasePath, GameState, Player, Rank}, + ui::{configuration, home, playing_field, ConfigurationView, HomeView, PlayingFieldView}, }; use serde::{Deserialize, Serialize}; use std::{ path::PathBuf, sync::{Arc, RwLock}, }; -use typeshare::typeshare; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] #[serde(tag = "type", content = "content")] pub enum CoreRequest { ChangeSetting(ChangeSettingRequest), @@ -22,34 +22,29 @@ pub enum CoreRequest { } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] #[serde(tag = "type", content = "content")] pub enum ChangeSettingRequest { LibraryPath(String), } #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub struct PlayStoneRequest { pub column: u8, pub row: u8, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub struct CreateGameRequest { pub black_player: PlayerInfoRequest, pub white_player: PlayerInfoRequest, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub enum PlayerInfoRequest { Hotseat(HotseatPlayerRequest), } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub struct HotseatPlayerRequest { pub name: String, pub rank: Option, @@ -65,7 +60,6 @@ impl From for Player { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] #[serde(tag = "type", content = "content")] pub enum CoreResponse { ConfigurationView(ConfigurationView), diff --git a/kifu/core/src/types.rs b/kifu/core/src/types.rs index cec63b6..a443b99 100644 --- a/kifu/core/src/types.rs +++ b/kifu/core/src/types.rs @@ -1,6 +1,6 @@ use crate::{ api::PlayStoneRequest, - board::{Goban, Coordinate}, + board::{Coordinate, Goban}, database::Database, }; use config::define_config; @@ -8,7 +8,6 @@ use config_derive::ConfigOption; use serde::{Deserialize, Serialize}; use std::{path::PathBuf, time::Duration}; use thiserror::Error; -use typeshare::typeshare; define_config! { DatabasePath(DatabasePath), @@ -52,14 +51,12 @@ pub enum BoardError { } #[derive(Clone, Copy, Debug, PartialEq, Hash, Eq, Serialize, Deserialize)] -#[typeshare] pub enum Color { Black, White, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub struct Size { pub width: u8, pub height: u8, @@ -99,7 +96,6 @@ impl AppState { } #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[typeshare] pub enum Rank { Kyu(u8), Dan(u8), diff --git a/kifu/core/src/ui/configuration.rs b/kifu/core/src/ui/configuration.rs index c15f408..4596374 100644 --- a/kifu/core/src/ui/configuration.rs +++ b/kifu/core/src/ui/configuration.rs @@ -3,10 +3,8 @@ use crate::{ ui::Field, }; use serde::{Deserialize, Serialize}; -use typeshare::typeshare; #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct ConfigurationView { pub library: Field<()>, } diff --git a/kifu/core/src/ui/elements/game_preview.rs b/kifu/core/src/ui/elements/game_preview.rs index 92e5120..88e5cc5 100644 --- a/kifu/core/src/ui/elements/game_preview.rs +++ b/kifu/core/src/ui/elements/game_preview.rs @@ -1,9 +1,7 @@ use serde::{Deserialize, Serialize}; use sgf::{Game, GameResult, Win}; -use typeshare::typeshare; #[derive(Clone, Debug, Deserialize, Serialize)] -#[typeshare] pub struct GamePreviewElement { pub date: String, pub name: String, diff --git a/kifu/core/src/ui/elements/menu.rs b/kifu/core/src/ui/elements/menu.rs index 25b06ed..13b6032 100644 --- a/kifu/core/src/ui/elements/menu.rs +++ b/kifu/core/src/ui/elements/menu.rs @@ -1,8 +1,6 @@ use serde::{Deserialize, Serialize}; -use typeshare::typeshare; #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct Menu { current: Option, options: Vec, diff --git a/kifu/core/src/ui/elements/mod.rs b/kifu/core/src/ui/elements/mod.rs index 61d07b4..c14c520 100644 --- a/kifu/core/src/ui/elements/mod.rs +++ b/kifu/core/src/ui/elements/mod.rs @@ -1,11 +1,9 @@ use serde::{Deserialize, Serialize}; -use typeshare::typeshare; pub mod game_preview; pub mod menu; #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct Action { pub id: String, pub label: String, @@ -13,7 +11,6 @@ pub struct Action { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct Toggle { pub id: String, pub label: String, @@ -22,7 +19,6 @@ pub struct Toggle { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct Field { pub id: String, pub label: String, diff --git a/kifu/core/src/ui/home.rs b/kifu/core/src/ui/home.rs index f19f8d4..983c63b 100644 --- a/kifu/core/src/ui/home.rs +++ b/kifu/core/src/ui/home.rs @@ -1,7 +1,6 @@ use crate::ui::{Action, GamePreviewElement}; use serde::{Deserialize, Serialize}; use sgf::Game; -use typeshare::typeshare; fn rank_strings() -> Vec { vec![ @@ -18,7 +17,6 @@ fn rank_strings() -> Vec { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub enum PlayerElement { Hotseat(HotseatPlayerElement), // Remote(RemotePlayerElement), @@ -32,7 +30,6 @@ impl Default for PlayerElement { } #[derive(Clone, Debug, Serialize, Deserialize, Default)] -#[typeshare] pub struct HotseatPlayerElement { pub placeholder: Option, pub default_rank: Option, @@ -40,15 +37,12 @@ pub struct HotseatPlayerElement { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct RemotePlayerElement {} #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct BotPlayerElement {} #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct HomeView { pub black_player: PlayerElement, pub white_player: PlayerElement, diff --git a/kifu/core/src/ui/playing_field.rs b/kifu/core/src/ui/playing_field.rs index d5ed200..d10d29c 100644 --- a/kifu/core/src/ui/playing_field.rs +++ b/kifu/core/src/ui/playing_field.rs @@ -3,10 +3,8 @@ use crate::{ ui::types, }; use serde::{Deserialize, Serialize}; -use typeshare::typeshare; #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct PlayingFieldView { pub board: types::BoardElement, pub player_card_black: types::PlayerCardElement, diff --git a/kifu/core/src/ui/types.rs b/kifu/core/src/ui/types.rs index ab855a3..4e60fa5 100644 --- a/kifu/core/src/ui/types.rs +++ b/kifu/core/src/ui/types.rs @@ -1,20 +1,17 @@ use crate::types::{Color, Size}; use crate::{ api::{CoreRequest, PlayStoneRequest}, - Goban, Coordinate, + Coordinate, Goban, }; use serde::{Deserialize, Serialize}; -use typeshare::typeshare; #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] -#[typeshare] pub struct Jitter { pub x: i8, pub y: i8, } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] -#[typeshare] pub struct StoneElement { pub color: Color, pub jitter: Jitter, @@ -32,7 +29,6 @@ impl StoneElement { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -#[typeshare] #[serde(tag = "type", content = "content")] pub enum IntersectionElement { Unplayable, @@ -41,7 +37,6 @@ pub enum IntersectionElement { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct BoardElement { pub size: Size, pub spaces: Vec, @@ -114,7 +109,6 @@ impl Default for BoardElement { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct PlayerCardElement { pub color: Color, pub name: String, @@ -123,11 +117,9 @@ pub struct PlayerCardElement { } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct ChatElement { pub messages: Vec, } #[derive(Clone, Debug, Serialize, Deserialize)] -#[typeshare] pub struct TextFieldElement {}