Skip to main content

Module state

Module state 

Source
Expand description

Canonical plugin-state wire format.

Lives in truce-utils (rather than truce-core) so build-time tools - cargo-truce emits factory-preset files containing this envelope at install time - can produce byte-identical blobs without inheriting truce-core’s runtime dependency chain. truce-core::state re-exports everything here and layers the plugin-coupled helpers (apply_state, snapshot_plugin, …) on top.

Structs§

DeserializedState
Deserialized state.

Enums§

StateParse
Outcome of parse_state: what the bytes turned out to be. Splits the causes deserialize_state collapses into one None so callers can route each one differently (fail the load, offer the bytes to the plugin’s migrate_state hook, …).

Functions§

deserialize_state
Deserialize plugin state. Thin wrapper over parse_state for callers that only care about the strict-success case (preset codecs, tests).
hash_plugin_id
Compute a simple hash of the plugin ID string for state identification.
parse_state
Parse a state blob, distinguishing every failure cause. See StateParse for the routing each variant is meant for.
serialize_state
Serialize plugin state: parameter values + extra state. Empty extra slice serializes as the same 0u64 length-prefix that an absent extra block would, so callers don’t need an Option wrapper to express “no extra state”.
vst3_cid
The 16-byte VST3 class ID for a plugin ID string.