pub trait Visitor {
// Required method
fn leaf(
&mut self,
path: &str,
array: &Array,
kind: LeafKind,
trainable: bool,
);
// Provided methods
fn paths(&self) -> bool { ... }
fn enter(&mut self, path: &str, name: &str, type_name: &'static str) { ... }
fn exit(&mut self, path: &str) { ... }
fn variant(&mut self, path: &str, index: u32) { ... }
fn mode(&mut self, path: &str, training: bool) { ... }
fn static_field(&mut self, path: &str, value: &dyn Static) { ... }
}Expand description
Receives what a Visit reports, with full paths. Every method but Visitor::leaf
has an empty default.
Required Methods§
Provided Methods§
Sourcefn paths(&self) -> bool
fn paths(&self) -> bool
Whether the visitor reads paths (true by default); without them, every path it
receives is empty and the visit builds none (faster).
Sourcefn enter(&mut self, path: &str, name: &str, type_name: &'static str)
fn enter(&mut self, path: &str, name: &str, type_name: &'static str)
A child tree of type type_name starts at path (name is its own segment; empty
for transparent wrappers such as Option).
Sourcefn variant(&mut self, path: &str, index: u32)
fn variant(&mut self, path: &str, index: u32)
An enum’s active variant (or Option’s: 0 for None, 1 for Some).
Sourcefn static_field(&mut self, path: &str, value: &dyn Static)
fn static_field(&mut self, path: &str, value: &dyn Static)
A static field (a hashed #[tree(skip)] field).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".