pub struct DepthCounter { /* private fields */ }Expand description
Visitor that counts maximum depth reached.
§Example
use hedl_core::visitor::{utils::DepthCounter, traverse, TraversalConfig};
use hedl_core::Document;
let doc = Document::new((1, 0));
let mut counter = DepthCounter::new();
traverse(&doc, &mut counter, &TraversalConfig::default());
assert_eq!(counter.max_depth(), 0);Implementations§
Trait Implementations§
Source§impl Debug for DepthCounter
impl Debug for DepthCounter
Source§impl Default for DepthCounter
impl Default for DepthCounter
Source§fn default() -> DepthCounter
fn default() -> DepthCounter
Returns the “default value” for a type. Read more
Source§impl Visitor for DepthCounter
impl Visitor for DepthCounter
Source§fn visit_node(
&mut self,
_node: &Node,
ctx: &VisitorContext<'_>,
) -> VisitDecision
fn visit_node( &mut self, _node: &Node, ctx: &VisitorContext<'_>, ) -> VisitDecision
Called when visiting a node (row) in a list. Read more
Source§fn visit_scalar(
&mut self,
_key: &str,
_value: &Value,
ctx: &VisitorContext<'_>,
) -> VisitDecision
fn visit_scalar( &mut self, _key: &str, _value: &Value, ctx: &VisitorContext<'_>, ) -> VisitDecision
Called when visiting a scalar value. Read more
Source§fn begin_document(
&mut self,
_doc: &Document,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn begin_document( &mut self, _doc: &Document, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called at the start of document traversal. Read more
Source§fn end_document(
&mut self,
_doc: &Document,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn end_document( &mut self, _doc: &Document, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called at the end of document traversal. Read more
Source§fn begin_object(
&mut self,
_key: &str,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn begin_object( &mut self, _key: &str, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called before visiting an object’s children. Read more
Source§fn end_object(&mut self, _key: &str, _ctx: &VisitorContext<'_>) -> VisitDecision
fn end_object(&mut self, _key: &str, _ctx: &VisitorContext<'_>) -> VisitDecision
Called after visiting an object’s children.
Source§fn begin_list(
&mut self,
_key: &str,
_list: &MatrixList,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn begin_list( &mut self, _key: &str, _list: &MatrixList, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called before visiting a list’s rows. Read more
Source§fn end_list(
&mut self,
_key: &str,
_list: &MatrixList,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn end_list( &mut self, _key: &str, _list: &MatrixList, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called after visiting a list’s rows.
Source§fn begin_node_children(
&mut self,
_node: &Node,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn begin_node_children( &mut self, _node: &Node, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called before visiting a node’s children. Read more
Source§fn end_node_children(
&mut self,
_node: &Node,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn end_node_children( &mut self, _node: &Node, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called after visiting a node’s children.
Source§fn visit_reference(
&mut self,
_reference: &Reference,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn visit_reference( &mut self, _reference: &Reference, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called when visiting a reference value. Read more
Source§fn visit_expression(
&mut self,
_expr: &Expression,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn visit_expression( &mut self, _expr: &Expression, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called when visiting an expression value. Read more
Source§fn visit_tensor(
&mut self,
_tensor: &Tensor,
_ctx: &VisitorContext<'_>,
) -> VisitDecision
fn visit_tensor( &mut self, _tensor: &Tensor, _ctx: &VisitorContext<'_>, ) -> VisitDecision
Called when visiting a tensor value. Read more
Auto Trait Implementations§
impl Freeze for DepthCounter
impl RefUnwindSafe for DepthCounter
impl Send for DepthCounter
impl Sync for DepthCounter
impl Unpin for DepthCounter
impl UnwindSafe for DepthCounter
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
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