summaryrefslogtreecommitdiff
path: root/src/model/styles.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-18 18:19:13 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-18 18:27:22 +0100
commita16726ae6652a795ff24f368ca25f93bae673366 (patch)
treecb9de3573b2d094ddc52cff9f24bd4ba6e3c5474 /src/model/styles.rs
parent533d4d57c6b65469e39d7b5d2289df1adb9cfb64 (diff)
Architecture description
Diffstat (limited to 'src/model/styles.rs')
-rw-r--r--src/model/styles.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/model/styles.rs b/src/model/styles.rs
index 8cccb5f6..7b725af9 100644
--- a/src/model/styles.rs
+++ b/src/model/styles.rs
@@ -343,12 +343,7 @@ impl Debug for Transform {
cast_from_value! {
Transform,
content: Content => Self::Content(content),
- func: Func => {
- if func.argc().map_or(false, |count| count != 1) {
- Err("function must have exactly one parameter")?
- }
- Self::Func(func)
- },
+ func: Func => Self::Func(func),
}
/// A chain of style maps, similar to a linked list.
@@ -494,6 +489,15 @@ impl<'a> StyleChain<'a> {
})
}
+ /// Convert to a style map.
+ pub fn to_map(self) -> StyleMap {
+ let mut suffix = StyleMap::new();
+ for link in self.links() {
+ suffix.0.splice(0..0, link.iter().cloned());
+ }
+ suffix
+ }
+
/// Iterate over the entries of the chain.
fn entries(self) -> Entries<'a> {
Entries { inner: [].as_slice().iter(), links: self.links() }