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(
#[typetag::deserialize(tag="outline")]
pub trait OutlineDefn: Debug + Sync + Send {
fn check(&self, lgi: &GroupData) -> Result<(),LLE>;
- fn load(&self, lgi: &GroupData) -> Result<OutlineRepr,IE>;
+ fn load(&self, lgi: &GroupData) -> Result<Outline,IE>;
}
#[derive(Debug)]
desc_hidden: DescId,
svgs: IndexVec<SvgId, Html>,
descs: IndexVec<DescId, Html>,
- outline: OutlineRepr,
+ outline: Outline,
}
#[derive(Debug,Clone,Serialize,Deserialize,Eq,PartialEq,Ord,PartialOrd)]
impl OutlineDefn for CircleDefn {
#[throws(LibraryLoadError)]
fn check(&self, lgd: &GroupData) { Self::get_size(lgd)?; }
- fn load(&self, lgd: &GroupData) -> Result<OutlineRepr,IE> {
+ fn load(&self, lgd: &GroupData) -> Result<Outline,IE> {
Ok(Circle {
diam: Self::get_size(lgd).map_err(|e| e.ought())?,
}.into())
impl OutlineDefn for SquareDefn {
#[throws(LibraryLoadError)]
fn check(&self, lgd: &GroupData) { Self::get(lgd)?; }
- fn load(&self, lgd: &GroupData) -> Result<OutlineRepr,IE> {
+ fn load(&self, lgd: &GroupData) -> Result<Outline,IE> {
Ok(
Self::get(lgd).map_err(|e| e.ought())?.into()
)
#[enum_dispatch(OutlineTrait)]
#[derive(Clone,Debug,Serialize,Deserialize)]
#[serde(tag="type")]
- pub enum OutlineRepr {
+ pub enum Outline {
Circle,
#[serde(alias="Square")] Rectangle,
}
pub colour: String,
pub edge: Option<ColourSpec>,
pub edge_width: Option<f64>,
- pub shape: OutlineRepr,
+ pub shape: Outline,
}
}