From a509413af5a743cacf017a55a3f239961b2d3569 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 27 Feb 2021 13:42:47 +0000 Subject: [PATCH] rename enum Outline Signed-off-by: Ian Jackson --- src/hand.rs | 2 +- src/pieces.rs | 2 +- src/shapelib.rs | 8 ++++---- src/spec.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hand.rs b/src/hand.rs index a9a8fd34..7761751f 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -50,7 +50,7 @@ impl PieceSpec for piece_specs::Hand { edge_width: self.edge_width, }; let shape = match self.shape { - OutlineRepr::Rectangle(r) => r, + Outline::Rectangle(r) => r, _ => throw!(SpecError::UnsupportedShape), }; let shape = GenericSimpleShape::new( diff --git a/src/pieces.rs b/src/pieces.rs index 5a2383f8..4615c79f 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -20,7 +20,7 @@ pub struct GenericSimpleShape { pub itemname: String, pub outline: Outl, } -pub type SimpleShape = GenericSimpleShape; +pub type SimpleShape = GenericSimpleShape; pub const SELECT_SCALE: f64 = 1.1; diff --git a/src/shapelib.rs b/src/shapelib.rs index e3145a75..a7e68a36 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -26,7 +26,7 @@ pub struct GroupData { #[typetag::deserialize(tag="outline")] pub trait OutlineDefn: Debug + Sync + Send { fn check(&self, lgi: &GroupData) -> Result<(),LLE>; - fn load(&self, lgi: &GroupData) -> Result; + fn load(&self, lgi: &GroupData) -> Result; } #[derive(Debug)] @@ -126,7 +126,7 @@ struct Item { desc_hidden: DescId, svgs: IndexVec, descs: IndexVec, - outline: OutlineRepr, + outline: Outline, } #[derive(Debug,Clone,Serialize,Deserialize,Eq,PartialEq,Ord,PartialOrd)] @@ -518,7 +518,7 @@ struct CircleDefn { } impl OutlineDefn for CircleDefn { #[throws(LibraryLoadError)] fn check(&self, lgd: &GroupData) { Self::get_size(lgd)?; } - fn load(&self, lgd: &GroupData) -> Result { + fn load(&self, lgd: &GroupData) -> Result { Ok(Circle { diam: Self::get_size(lgd).map_err(|e| e.ought())?, }.into()) @@ -567,7 +567,7 @@ struct SquareDefn { } impl OutlineDefn for SquareDefn { #[throws(LibraryLoadError)] fn check(&self, lgd: &GroupData) { Self::get(lgd)?; } - fn load(&self, lgd: &GroupData) -> Result { + fn load(&self, lgd: &GroupData) -> Result { Ok( Self::get(lgd).map_err(|e| e.ought())?.into() ) diff --git a/src/spec.rs b/src/spec.rs index 5f333cd9..3064a2eb 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -202,7 +202,7 @@ mod outline { #[enum_dispatch(OutlineTrait)] #[derive(Clone,Debug,Serialize,Deserialize)] #[serde(tag="type")] - pub enum OutlineRepr { + pub enum Outline { Circle, #[serde(alias="Square")] Rectangle, } @@ -241,7 +241,7 @@ pub mod piece_specs { pub colour: String, pub edge: Option, pub edge_width: Option, - pub shape: OutlineRepr, + pub shape: Outline, } } -- 2.30.2