Admission and ownership¶
Unsafe state::Provider::from_raw establishes the same executable, thread and
native-code trust as the instance provider. Its companion points to the exact
instance table; an equivalent-looking different table is rejected before native
state calls. The copied table borrow is neither Send nor Sync. All state methods
require exclusive access to an initialized, stopped, deactivated, non-faulted child
on its original platform main thread, before first preparation or after joined
audio teardown and stop. Parent control guards reject foreign lifecycle/state
reentry. All mutable CONTROL operations require every audio scope across the
parent joined; shared keeper geometry stays fixed during AUDIO. No SDK interface
or stream escapes the safe Rust API.
CaptureCapacity::new(component, controller) accepts explicit capacities of
1..8 MiB each, including a controller buffer when the instance has no controller.
There is no sizing retry. capture_state allocates owned output and captures
mandatory component state, then optional controller-own state. ControllerState
distinguishes no controller, a controller returning SDK NotImplemented, and
successfully captured bytes. Successful empty bytes are supported state, not
an unsupported getter. Any other controller failure rejects the whole capture.
Only a fully successful transaction publishes a snapshot; raw output prefixes,
record and backing tails remain unchanged on failed capture. A foreign getter may
still change its own private state; this API promises no getter rollback.
Snapshot owns copied bytes, controller metadata and the component's opaque
16-byte class UID. It can move between threads without retaining native objects.
Snapshot::new admits bounded caller-owned bytes; neither constructor nor restore
authenticates a plug-in's version, schema, state encoding or native code. Restore
checks class UID, controller presence, lengths and every native range again.