pub struct BoundedNode<V> { /* private fields */ }Expand description
A Node with a bounded number of child Nodes.
Child Nodes 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. BoundedNodes with capacity zero do not store any Vs.
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more