Remove typeshare from kifu
This commit is contained in:
parent
e838f601ca
commit
a1f41a440f
|
@ -2232,7 +2232,6 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sgf",
|
"sgf",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"typeshare",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -15,7 +15,6 @@ grid = { version = "0.9" }
|
||||||
serde_json = { version = "1" }
|
serde_json = { version = "1" }
|
||||||
serde = { version = "1", features = [ "derive" ] }
|
serde = { version = "1", features = [ "derive" ] }
|
||||||
thiserror = { version = "1" }
|
thiserror = { version = "1" }
|
||||||
typeshare = { version = "1" }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
cool_asserts = { version = "2" }
|
cool_asserts = { version = "2" }
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
use crate::{
|
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 serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{Arc, RwLock},
|
sync::{Arc, RwLock},
|
||||||
};
|
};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
#[serde(tag = "type", content = "content")]
|
#[serde(tag = "type", content = "content")]
|
||||||
pub enum CoreRequest {
|
pub enum CoreRequest {
|
||||||
ChangeSetting(ChangeSettingRequest),
|
ChangeSetting(ChangeSettingRequest),
|
||||||
|
@ -22,34 +22,29 @@ pub enum CoreRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
#[serde(tag = "type", content = "content")]
|
#[serde(tag = "type", content = "content")]
|
||||||
pub enum ChangeSettingRequest {
|
pub enum ChangeSettingRequest {
|
||||||
LibraryPath(String),
|
LibraryPath(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct PlayStoneRequest {
|
pub struct PlayStoneRequest {
|
||||||
pub column: u8,
|
pub column: u8,
|
||||||
pub row: u8,
|
pub row: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct CreateGameRequest {
|
pub struct CreateGameRequest {
|
||||||
pub black_player: PlayerInfoRequest,
|
pub black_player: PlayerInfoRequest,
|
||||||
pub white_player: PlayerInfoRequest,
|
pub white_player: PlayerInfoRequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub enum PlayerInfoRequest {
|
pub enum PlayerInfoRequest {
|
||||||
Hotseat(HotseatPlayerRequest),
|
Hotseat(HotseatPlayerRequest),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct HotseatPlayerRequest {
|
pub struct HotseatPlayerRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub rank: Option<String>,
|
pub rank: Option<String>,
|
||||||
|
@ -65,7 +60,6 @@ impl From<HotseatPlayerRequest> for Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
#[serde(tag = "type", content = "content")]
|
#[serde(tag = "type", content = "content")]
|
||||||
pub enum CoreResponse {
|
pub enum CoreResponse {
|
||||||
ConfigurationView(ConfigurationView),
|
ConfigurationView(ConfigurationView),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
api::PlayStoneRequest,
|
api::PlayStoneRequest,
|
||||||
board::{Goban, Coordinate},
|
board::{Coordinate, Goban},
|
||||||
database::Database,
|
database::Database,
|
||||||
};
|
};
|
||||||
use config::define_config;
|
use config::define_config;
|
||||||
|
@ -8,7 +8,6 @@ use config_derive::ConfigOption;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{path::PathBuf, time::Duration};
|
use std::{path::PathBuf, time::Duration};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
define_config! {
|
define_config! {
|
||||||
DatabasePath(DatabasePath),
|
DatabasePath(DatabasePath),
|
||||||
|
@ -52,14 +51,12 @@ pub enum BoardError {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub enum Color {
|
pub enum Color {
|
||||||
Black,
|
Black,
|
||||||
White,
|
White,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Size {
|
pub struct Size {
|
||||||
pub width: u8,
|
pub width: u8,
|
||||||
pub height: u8,
|
pub height: u8,
|
||||||
|
@ -99,7 +96,6 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub enum Rank {
|
pub enum Rank {
|
||||||
Kyu(u8),
|
Kyu(u8),
|
||||||
Dan(u8),
|
Dan(u8),
|
||||||
|
|
|
@ -3,10 +3,8 @@ use crate::{
|
||||||
ui::Field,
|
ui::Field,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct ConfigurationView {
|
pub struct ConfigurationView {
|
||||||
pub library: Field<()>,
|
pub library: Field<()>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sgf::{Game, GameResult, Win};
|
use sgf::{Game, GameResult, Win};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct GamePreviewElement {
|
pub struct GamePreviewElement {
|
||||||
pub date: String,
|
pub date: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Menu<T: PartialEq + Eq> {
|
pub struct Menu<T: PartialEq + Eq> {
|
||||||
current: Option<T>,
|
current: Option<T>,
|
||||||
options: Vec<T>,
|
options: Vec<T>,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
pub mod game_preview;
|
pub mod game_preview;
|
||||||
pub mod menu;
|
pub mod menu;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Action<A> {
|
pub struct Action<A> {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub label: String,
|
pub label: String,
|
||||||
|
@ -13,7 +11,6 @@ pub struct Action<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Toggle<A> {
|
pub struct Toggle<A> {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub label: String,
|
pub label: String,
|
||||||
|
@ -22,7 +19,6 @@ pub struct Toggle<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Field<A> {
|
pub struct Field<A> {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub label: String,
|
pub label: String,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use crate::ui::{Action, GamePreviewElement};
|
use crate::ui::{Action, GamePreviewElement};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sgf::Game;
|
use sgf::Game;
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
fn rank_strings() -> Vec<String> {
|
fn rank_strings() -> Vec<String> {
|
||||||
vec![
|
vec![
|
||||||
|
@ -18,7 +17,6 @@ fn rank_strings() -> Vec<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub enum PlayerElement {
|
pub enum PlayerElement {
|
||||||
Hotseat(HotseatPlayerElement),
|
Hotseat(HotseatPlayerElement),
|
||||||
// Remote(RemotePlayerElement),
|
// Remote(RemotePlayerElement),
|
||||||
|
@ -32,7 +30,6 @@ impl Default for PlayerElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
||||||
#[typeshare]
|
|
||||||
pub struct HotseatPlayerElement {
|
pub struct HotseatPlayerElement {
|
||||||
pub placeholder: Option<String>,
|
pub placeholder: Option<String>,
|
||||||
pub default_rank: Option<String>,
|
pub default_rank: Option<String>,
|
||||||
|
@ -40,15 +37,12 @@ pub struct HotseatPlayerElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct RemotePlayerElement {}
|
pub struct RemotePlayerElement {}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct BotPlayerElement {}
|
pub struct BotPlayerElement {}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct HomeView {
|
pub struct HomeView {
|
||||||
pub black_player: PlayerElement,
|
pub black_player: PlayerElement,
|
||||||
pub white_player: PlayerElement,
|
pub white_player: PlayerElement,
|
||||||
|
|
|
@ -3,10 +3,8 @@ use crate::{
|
||||||
ui::types,
|
ui::types,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct PlayingFieldView {
|
pub struct PlayingFieldView {
|
||||||
pub board: types::BoardElement,
|
pub board: types::BoardElement,
|
||||||
pub player_card_black: types::PlayerCardElement,
|
pub player_card_black: types::PlayerCardElement,
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
use crate::types::{Color, Size};
|
use crate::types::{Color, Size};
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{CoreRequest, PlayStoneRequest},
|
api::{CoreRequest, PlayStoneRequest},
|
||||||
Goban, Coordinate,
|
Coordinate, Goban,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use typeshare::typeshare;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct Jitter {
|
pub struct Jitter {
|
||||||
pub x: i8,
|
pub x: i8,
|
||||||
pub y: i8,
|
pub y: i8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct StoneElement {
|
pub struct StoneElement {
|
||||||
pub color: Color,
|
pub color: Color,
|
||||||
pub jitter: Jitter,
|
pub jitter: Jitter,
|
||||||
|
@ -32,7 +29,6 @@ impl StoneElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
#[serde(tag = "type", content = "content")]
|
#[serde(tag = "type", content = "content")]
|
||||||
pub enum IntersectionElement {
|
pub enum IntersectionElement {
|
||||||
Unplayable,
|
Unplayable,
|
||||||
|
@ -41,7 +37,6 @@ pub enum IntersectionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct BoardElement {
|
pub struct BoardElement {
|
||||||
pub size: Size,
|
pub size: Size,
|
||||||
pub spaces: Vec<IntersectionElement>,
|
pub spaces: Vec<IntersectionElement>,
|
||||||
|
@ -114,7 +109,6 @@ impl Default for BoardElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct PlayerCardElement {
|
pub struct PlayerCardElement {
|
||||||
pub color: Color,
|
pub color: Color,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -123,11 +117,9 @@ pub struct PlayerCardElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct ChatElement {
|
pub struct ChatElement {
|
||||||
pub messages: Vec<String>,
|
pub messages: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[typeshare]
|
|
||||||
pub struct TextFieldElement {}
|
pub struct TextFieldElement {}
|
||||||
|
|
Loading…
Reference in New Issue