Share packed native lists across copied boxes and shipouts
This commit is contained in:
1 parent
ca3730338e
commit
da48cf9cad
16 files changed
+157
-67
No files matched your search
@@ -50,8 +50,8 @@ fn descend_mut<'a>(b: &'a mut NativeBox, path: &[usize]) -> &'a mut NativeBox {
|
||||
None => b,
|
||||
Some((&i, rest)) => descend_mut(
|
||||
match &mut b.content {
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut v[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut v[i]),
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
},
|
||||
rest,
|
||||
),
|
||||
@@ -60,8 +60,8 @@ fn descend_mut<'a>(b: &'a mut NativeBox, path: &[usize]) -> &'a mut NativeBox {
|
||||
fn refresh(b: &mut NativeBox, path: &[usize]) {
|
||||
if let Some((&i, rest)) = path.split_first() {
|
||||
let child = match &mut b.content {
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut v[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut v[i]),
|
||||
BoxContent::Vertical(v) => vertical_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
BoxContent::Horizontal(v) => text_box_mut(&mut Arc::make_mut(v)[i]),
|
||||
};
|
||||
refresh(child, rest);
|
||||
}
|
||||
@@ -130,8 +130,8 @@ impl VerticalBuilder {
|
||||
pub(in crate::execution) fn push(&mut self, node: NativeVerticalNode) {
|
||||
match self.tail_box_mut().map(|b| &mut b.content) {
|
||||
None => self.nodes.push(node),
|
||||
Some(BoxContent::Vertical(v)) => v.push(node),
|
||||
Some(BoxContent::Horizontal(v)) => v.push(horizontal(node)),
|
||||
Some(BoxContent::Vertical(v)) => Arc::make_mut(v).push(node),
|
||||
Some(BoxContent::Horizontal(v)) => Arc::make_mut(v).push(horizontal(node)),
|
||||
}
|
||||
self.refresh_tail();
|
||||
}
|
||||
@@ -169,8 +169,8 @@ impl VerticalBuilder {
|
||||
fn pop(&mut self) -> Option<Removed> {
|
||||
let node = match self.tail_box_mut().map(|b| &mut b.content) {
|
||||
None => self.nodes.pop().map(Removed::Vertical),
|
||||
Some(BoxContent::Vertical(v)) => v.pop().map(Removed::Vertical),
|
||||
Some(BoxContent::Horizontal(v)) => v.pop().map(Removed::Text),
|
||||
Some(BoxContent::Vertical(v)) => Arc::make_mut(v).pop().map(Removed::Vertical),
|
||||
Some(BoxContent::Horizontal(v)) => Arc::make_mut(v).pop().map(Removed::Text),
|
||||
};
|
||||
self.refresh_tail();
|
||||
node
|
||||
|
||||
Reference in new issue
Block a user