type IR = Result<(),IE>;
type SE = SVGProcessingError;
-#[typetag::serde]
pub trait Outline : Send + Debug {
fn surround_path(&self, pri : &PieceRenderInstructions) -> Result<Html, IE>;
fn thresh_dragraise(&self, pri : &PieceRenderInstructions)
-> Result<Option<Coord>, IE>;
}
+#[typetag::serde]
+pub trait JustOutline : Outline + Send + Debug { }
+
#[typetag::serde]
pub trait Piece : Outline + Send + Debug {
fn resolve_spec_face(&self, face : Option<FaceId>)
outline: Box<dyn Outline>,
}
-#[typetag::serde(name="Lib")]
impl Outline for Item { delegate! { to self.outline {
fn surround_path(&self, pri : &PieceRenderInstructions) -> Result<Html, IE>;
fn thresh_dragraise(&self, pri : &PieceRenderInstructions)
-> Result<Option<Coord>, IE>;
}}}
+#[typetag::serde(name="Lib")]
+impl JustOutline for Item { }
+
#[typetag::serde(name="Lib")]
impl Piece for Item {
#[throws(SpecError)]
#[derive(Serialize,Deserialize,Debug)]
struct Circle { diam: f64 }
-#[typetag::serde(name="Circle")]
impl Outline for Circle {
#[throws(IE)]
fn surround_path(&self, _pri : &PieceRenderInstructions) -> Html {
Some(self.diam / 2)
}
}
+#[typetag::serde(name="Circle")]
+impl JustOutline for Circle { }
#[derive(Deserialize,Debug)]
struct CircleDefn { }