chiark / gitweb /
wip shapelib impl Piece etc., does not build
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 17 Sep 2020 00:03:04 +0000 (01:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 17 Sep 2020 00:03:04 +0000 (01:03 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
demo/test.game.toml
src/shapelib.rs

index 3ce5b310d5886fdbc788c6d9324af79c8b03860b..8d973b6f55e9932da36ad5ca8d417402cceaa212 100644 (file)
@@ -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"
index edc0cf931e71c64dbd012bf7febe71e73c046391..6103796280b31ac1cbb0b05ae59bcfe420bf17cc 100644 (file)
@@ -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<Box<dyn Piece>,SpecError> {
+    Ok(Box::new(LibraryPiece {
+    }))
+  }
+}
+
+
 #[throws(LibraryLoadError)]
 fn resolve_inherit<'r>(depth: u8, groups: &toml::value::Table,
                        group_name: &str, group: &'r toml::Value)