tvm_ffi::extra::structural_visit

Trait StructuralVisitorBase

Source
pub unsafe trait StructuralVisitorBase: Sized {
    // Provided method
    unsafe fn default_visit<D>(
        _this: *mut Self,
        dispatch: &mut D,
        value: AnyView<'_>,
        visitor: &mut StructuralVisitorView<'_, D>,
    ) -> Result<Option<VisitInterrupt>> { ... }
}
Expand description

A concrete base that customizes default descent.

§Safety

Self must have #[repr(C)] with a StructuralVisitorObj as its first field at offset zero. Do not replace its runtime header or vtable. The callback is synchronous and non-escaping; raw base pointers and runtime handles must not be retained. Field references must end before recursion that may access them. In particular, never form a reference to the whole base across recursive calls.

Provided Methods§

Source

unsafe fn default_visit<D>( _this: *mut Self, dispatch: &mut D, value: AnyView<'_>, visitor: &mut StructuralVisitorView<'_, D>, ) -> Result<Option<VisitInterrupt>>

Override default descent; delegate to StructuralVisitorObj::default_visit to visit children through the registered hook or reflected fields.

§Safety

this is the live base of visitor; use it only for this synchronous call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§