polish: tests and documentation

This commit is contained in:
Jonathan Kelley committed 2021-09-09 20:58:48 -04:00
1 parent 0896f34493
commit da8159190b
27 files changed
+467 -569

No files matched your search

+8 -9
View File
@@ -3,23 +3,18 @@ use smallvec::{smallvec, SmallVec};
/// The stack instructions we use to diff and create new nodes.
#[derive(Debug)]
pub enum DiffInstruction<'a> {
DiffNode {
pub(crate) enum DiffInstruction<'a> {
Diff {
old: &'a VNode<'a>,
new: &'a VNode<'a>,
},
DiffChildren {
old: &'a [VNode<'a>],
new: &'a [VNode<'a>],
},
Create {
node: &'a VNode<'a>,
},
/// pushes the node elements onto the stack for use in mount
PrepareMoveNode {
PrepareMove {
node: &'a VNode<'a>,
},
@@ -35,7 +30,7 @@ pub enum MountType<'a> {
Absorb,
Append,
Replace { old: &'a VNode<'a> },
ReplaceByElementId { el: ElementId },
ReplaceByElementId { el: Option<ElementId> },
InsertAfter { other_node: &'a VNode<'a> },
InsertBefore { other_node: &'a VNode<'a> },
}
@@ -63,6 +58,10 @@ impl<'bump> DiffStack<'bump> {
self.instructions.pop()
}
pub fn pop_off_scope(&mut self) {
self.scope_stack.pop();
}
pub fn pop_scope(&mut self) -> Option<ScopeId> {
self.scope_stack.pop()
}