#[derive(Debug,Serialize,Deserialize)]
struct Hand {
- shape: GenericSimpleShape<()>,
+ shape: GenericSimpleShape<(), OutlineRepr>,
}
#[derive(Debug,Clone,Default,Serialize,Deserialize)]
#[derive(Debug,Serialize,Deserialize)]
// todo: this serialisation is rather large
-pub struct GenericSimpleShape<Desc> {
+pub struct GenericSimpleShape<Desc, Outl> {
pub desc: Desc,
colours: ColourMap,
#[serde(default)] pub edges: ColourMap,
#[serde(default="default_edge_width")] pub edge_width: f64,
pub itemname: String,
- pub outline: OutlineRepr,
+ pub outline: Outl,
}
-pub type SimpleShape = GenericSimpleShape<Html>;
+pub type SimpleShape = GenericSimpleShape<Html, OutlineRepr>;
pub const SELECT_SCALE: f64 = 1.1;
-x*0.5, -y*0.5, x, y, -x))
}
-impl<Desc> Outline for GenericSimpleShape<Desc>
- where Desc: Debug + Send + Sync + 'static
+impl<Desc, Outl> Outline for GenericSimpleShape<Desc, Outl>
+ where Desc: Debug + Send + Sync + 'static,
+ Outl: Outline,
{
delegate! {
to self.outline {
fn itemname(&self) -> &str { self.itemname() }
}
-impl<Desc> GenericSimpleShape<Desc>
- where Desc: Debug + Send + Sync + 'static
+impl<Desc, Outl> GenericSimpleShape<Desc, Outl>
+ where Desc: Debug + Send + Sync + 'static,
+ Outl: Outline,
{
pub fn count_faces(&self) -> usize {
max(self.colours.len(), self.edges.len())
pub fn itemname(&self) -> &str { &self.itemname }
#[throws(SpecError)]
- pub fn new(desc: Desc, outline: OutlineRepr,
+ pub fn new(desc: Desc, outline: Outl,
def_itemname: &'_ str,
common: &SimpleCommon)
- -> GenericSimpleShape<Desc>
+ -> GenericSimpleShape<Desc, Outl>
{
let itemname = common.itemname.clone()
.unwrap_or_else(|| def_itemname.to_string());