From 7eca9752b662ee7edf428b425b22820b82f4ec80 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 17 Sep 2020 01:03:04 +0100 Subject: [PATCH] wip shapelib impl Piece etc., does not build Signed-off-by: Ian Jackson --- demo/test.game.toml | 6 ++++++ src/shapelib.rs | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/demo/test.game.toml b/demo/test.game.toml index 3ce5b310..8d973b6f 100644 --- a/demo/test.game.toml +++ b/demo/test.game.toml @@ -15,3 +15,9 @@ pos = [90, 60] type = "Square" size = [20] faces = ["blue", "grey"] + +[[pieces]] +pos = [90,100] +type = "Lib" +lib = "wikimedia" +file = "chess-w-n" diff --git a/src/shapelib.rs b/src/shapelib.rs index edc0cf93..61037962 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -78,6 +78,30 @@ const INHERIT_DEPTH_LIMIT : u8 = 20; type LLE = LibraryLoadError; type TV = toml::Value; +#[derive(Debug,Serialize,Deserialize)] +pub struct LibPieceSpec { + lib: String, + file: String, +} + +#[derive(Debug,Serialize,Deserialize)] +struct LibraryPiece { + +} + +#[typetag::serde(name="LP")] +impl Piece for LibraryPiece { +} + +#[typetag::serde(name="Lib")] +impl PieceSpec for LibPieceSpec { + fn load(&self) -> Result,SpecError> { + Ok(Box::new(LibraryPiece { + })) + } +} + + #[throws(LibraryLoadError)] fn resolve_inherit<'r>(depth: u8, groups: &toml::value::Table, group_name: &str, group: &'r toml::Value) -- 2.30.2