diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-18 18:19:13 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-18 18:27:22 +0100 |
| commit | a16726ae6652a795ff24f368ca25f93bae673366 (patch) | |
| tree | cb9de3573b2d094ddc52cff9f24bd4ba6e3c5474 /library | |
| parent | 533d4d57c6b65469e39d7b5d2289df1adb9cfb64 (diff) | |
Architecture description
Diffstat (limited to 'library')
| -rw-r--r-- | library/src/layout/mod.rs | 7 | ||||
| -rw-r--r-- | library/src/meta/query.rs | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs index b29da700..4a38acb6 100644 --- a/library/src/layout/mod.rs +++ b/library/src/layout/mod.rs @@ -380,8 +380,11 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> { let Some(doc) = &mut self.doc else { return Ok(()) }; if !self.flow.0.is_empty() || (doc.keep_next && styles.is_some()) { let (flow, shared) = mem::take(&mut self.flow).0.finish(); - let styles = - if shared == StyleChain::default() { styles.unwrap() } else { shared }; + let styles = if shared == StyleChain::default() { + styles.unwrap_or_default() + } else { + shared + }; let page = PageNode::new(FlowNode::new(flow.to_vec()).pack()).pack(); let stored = self.scratch.content.alloc(page); self.accept(stored, styles)?; diff --git a/library/src/meta/query.rs b/library/src/meta/query.rs index bab8ed7c..86419be0 100644 --- a/library/src/meta/query.rs +++ b/library/src/meta/query.rs @@ -39,14 +39,14 @@ cast_from_value! { /// Display: Query /// Category: special #[node(Locatable, Show)] -pub struct QueryNode { +struct QueryNode { /// The thing to search for. #[required] - pub target: Selector, + target: Selector, /// The function to format the results with. #[required] - pub format: Func, + format: Func, } impl Show for QueryNode { @@ -58,7 +58,6 @@ impl Show for QueryNode { let id = self.0.stable_id().unwrap(); let target = self.target(); let (before, after) = vt.introspector.query_split(target, id); - let func = self.format(); - Ok(func.call_vt(vt, [before.into(), after.into()])?.display()) + Ok(self.format().call_vt(vt, [before.into(), after.into()])?.display()) } } |
