pub struct NodeMarks { /* private fields */ }Expand description
Marks on the nodes of one MemoryApplier, for one walk over its tree.
A mark is a byte; an unmarked node reads 0. Marks stay until
NodeMarks::reset, and only a walk that leaves the applier’s tree as it
is may keep them: a node stored again in another place loses its mark.
use cranpose_core::{MemoryApplier, NodeMarks};
let applier = MemoryApplier::new();
let mut marks = NodeMarks::default();
marks.reset(&applier);
assert_eq!(marks.get(&applier, 7), 0);
marks.set(&applier, 7, 2);
assert_eq!(marks.get(&applier, 7), 2);Implementations§
Source§impl NodeMarks
impl NodeMarks
Sourcepub fn reset(&mut self, applier: &MemoryApplier)
pub fn reset(&mut self, applier: &MemoryApplier)
Unmarks every node, with room for every node applier holds now.
Sourcepub fn get(&self, applier: &MemoryApplier, id: NodeId) -> u8
pub fn get(&self, applier: &MemoryApplier, id: NodeId) -> u8
The mark of id: 0 while it has none.
Sourcepub fn set(&mut self, applier: &MemoryApplier, id: NodeId, mark: u8)
pub fn set(&mut self, applier: &MemoryApplier, id: NodeId, mark: u8)
Marks id with mark.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeMarks
impl RefUnwindSafe for NodeMarks
impl Send for NodeMarks
impl Sync for NodeMarks
impl Unpin for NodeMarks
impl UnsafeUnpin for NodeMarks
impl UnwindSafe for NodeMarks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more