pub struct BoundedNode<V> { /* private fields */ }
Expand description
A Node
with a bounded number of child Node
s.
Child Node
s at indices [begin, end)
are guaranteed to be fully constructed.
let inspector = Inspector::default();
let mut bounded_node =
BoundedNode::from_node_and_capacity(inspector.root().create_child("bounded-node"), 2);
struct Item {
_node: Node,
}
bounded_node.push(|n| {
n.record_string("dropped-field", "dropped-value");
Item { _node: n }
});
bounded_node.push(|n| {
n.record_string("some-field", "some-value");
Item { _node: n }
});
bounded_node.push(|n| {
n.record_string("other-field", "other-value");
Item { _node: n }
});
assert_data_tree!(
inspector,
root: {
"bounded-node": {
"capacity": 2u64,
"begin": 1u64,
"end": 3u64,
"children": {
"1": { "some-field": "some-value" },
"2": { "other-field": "other-value" }
}
}
}
)
Implementations§
Source§impl<V> BoundedNode<V>
impl<V> BoundedNode<V>
Sourcepub fn from_node_and_capacity(node: Node, capacity: usize) -> Self
pub fn from_node_and_capacity(node: Node, capacity: usize) -> Self
Creates a BoundedNode
. BoundedNode
s with capacity
zero do not store any V
s.
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for BoundedNode<V>
impl<V> !RefUnwindSafe for BoundedNode<V>
impl<V> Send for BoundedNode<V>where
V: Send,
impl<V> Sync for BoundedNode<V>where
V: Sync,
impl<V> Unpin for BoundedNode<V>where
V: Unpin,
impl<V> !UnwindSafe for BoundedNode<V>
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