pub unsafe trait StructuralVisitorBase: Sized {
// Required methods
fn new() -> Result<Self>;
fn type_index() -> i32;
unsafe fn default_visit_raw(
runtime: *mut Self,
value: AnyView<'_>,
) -> TVMFFIAny;
}Expand description
Native state and default traversal for StructuralVisitEngine.
The engine owns allocation, scoped dispatch and results.
§Safety
Self must have a complete initialized C layout with StructuralVisitorObj
at offset zero, matching its registered native type and every field hooks access.
Native-mutated fields require interior mutability; shared references must not
freeze them during recursion. Hooks must preserve the vtable and valid region state.
The base must not implement crate::ObjectCore or otherwise allow callers
to retain the runtime. Hooks may access the runtime and borrowed traversal
state only synchronously, on the calling thread.
default_visit_raw returns one owning ABI None/Error/VisitInterrupt and recurses only
through the installed vtable, without a whole-base mutable reference spanning
recursion. Failures use that result carrier; panics must not cross native callbacks.
Required Methods§
Sourcefn new() -> Result<Self>
fn new() -> Result<Self>
Initialize the complete base before the engine installs its runtime header.
Sourcefn type_index() -> i32
fn type_index() -> i32
Native type registered for this complete base layout.
Sourceunsafe fn default_visit_raw(runtime: *mut Self, value: AnyView<'_>) -> TVMFFIAny
unsafe fn default_visit_raw(runtime: *mut Self, value: AnyView<'_>) -> TVMFFIAny
Descend from a borrowed value without dispatching that value again. Return one owning ABI None, Error, or VisitInterrupt value. Children reenter the installed vtable. The ordinary implementation accesses only the visitor prefix, so specialized bases may reuse it.
§Safety
runtime is this live initialized base with a matching installed vtable.
The input and runtime remain borrowed for this synchronous call. The
caller has published the current exclusive dispatcher reborrow.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".