diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-02 15:41:39 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-02 15:45:18 +0100 |
| commit | 9bc90c371fb41a2d6dc08eb4673e5be15f829514 (patch) | |
| tree | 454a47ce82c2229e79a139a8bdeaed9add1e0a14 /src/model/cast.rs | |
| parent | 5110a41de1ca2236739ace2d37a1af912bb029f1 (diff) | |
Introspection
Diffstat (limited to 'src/model/cast.rs')
| -rw-r--r-- | src/model/cast.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/model/cast.rs b/src/model/cast.rs index 6a78eebd..bfde1bdd 100644 --- a/src/model/cast.rs +++ b/src/model/cast.rs @@ -255,18 +255,24 @@ castable! { } castable! { - Destination, - Expected: "string or dictionary with `page`, `x`, and `y` keys", - Value::Str(string) => Self::Url(string.into()), + Location, + Expected: "dictionary with `page`, `x`, and `y` keys", Value::Dict(dict) => { let page = dict.get("page")?.clone().cast()?; let x: Length = dict.get("x")?.clone().cast()?; let y: Length = dict.get("y")?.clone().cast()?; - Self::Internal(Location { page, pos: Point::new(x.abs, y.abs) }) + Self { page, pos: Point::new(x.abs, y.abs) } }, } castable! { + Destination, + Expected: "string or dictionary with `page`, `x`, and `y` keys", + Value::Str(string) => Self::Url(string.into()), + v @ Value::Dict(_) => Self::Internal(v.cast()?), +} + +castable! { FontStyle, Expected: "string", Value::Str(string) => match string.as_str() { |
