diff options
Diffstat (limited to 'src/library/mod.rs')
| -rw-r--r-- | src/library/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/library/mod.rs b/src/library/mod.rs index 8f00e5fe..88f003c2 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -53,6 +53,7 @@ pub fn new() -> Scope { // Graphics. std.def_node::<graphics::ImageNode>("image"); + std.def_node::<graphics::LineNode>("line"); std.def_node::<graphics::RectNode>("rect"); std.def_node::<graphics::SquareNode>("square"); std.def_node::<graphics::EllipseNode>("ellipse"); @@ -170,3 +171,14 @@ castable! { Expected: "content", Value::Content(content) => content.pack(), } + +castable! { + Spec<Linear>, + Expected: "two-dimensional length array", + Value::Array(array) => { + let e = "point array must contain exactly two entries"; + let a = array.get(0).map_err(|_| e)?.clone().cast::<Linear>()?; + let b = array.get(1).map_err(|_| e)?.clone().cast::<Linear>()?; + Spec::new(a, b) + }, +} |
