pub trait ContextPolicy<State> {
// Required method
fn default_visit(
&self,
value: &StructuralView,
visitor: &mut VisitContext<'_, State>,
) -> Result<Option<VisitInterrupt>>;
}Expand description
A reusable policy for managing context around default visit and walk recursion.
visit_children() on this policy’s context continues with the next policy
(or the built-in hooks and reflected fields). visit() re-enters the full
callback engine for a child. A tuple (outer, inner) composes two policies;
tuples may nest. Policies receive &self; mutable pass data belongs in the
context’s state. Save and restore scoped state around descent.
Required Methods§
Sourcefn default_visit(
&self,
value: &StructuralView,
visitor: &mut VisitContext<'_, State>,
) -> Result<Option<VisitInterrupt>>
fn default_visit( &self, value: &StructuralView, visitor: &mut VisitContext<'_, State>, ) -> Result<Option<VisitInterrupt>>
Customize default descent for the current value.
Return interrupts explicitly, and restore any scoped state before returning an interrupt or error. Walk invokes this between its pre- and post-order callback positions; visit invokes it only on callback miss or when a matched callback requests default descent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".