pub unsafe trait StructuralMutatorBase: Sized {
// Required methods
fn new() -> Result<Self>;
fn type_index() -> i32;
unsafe fn default_mutate_raw(
runtime: *mut Self,
value: MutationView<'_>,
) -> TVMFFIAny;
}Expand description
Native state and default mutation for StructuralMutateEngine.
The engine owns allocation, scoped dispatch, identity remaps and results.
§Safety
Self must have a complete initialized C layout with StructuralMutatorObj
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 mutation
state only synchronously, on the calling thread.
default_mutate_raw returns one owning ABI replacement/Unchanged/Error and recurses
only through the installed vtable, preserving the input’s in-place mode.
No whole-base mutable reference may span recursion. Failures use the 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_mutate_raw(
runtime: *mut Self,
value: MutationView<'_>,
) -> TVMFFIAny
unsafe fn default_mutate_raw( runtime: *mut Self, value: MutationView<'_>, ) -> TVMFFIAny
Descend from a borrowed view without dispatching that value again.
§Safety
runtime is the base of a live StructuralMutateEngine<Self> with its
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".