pub struct SnapshotSlot { /* private fields */ }Expand description
Shared handle to the published custom-state bytes. Held by the shell
(producer, audio thread) and the format wrapper (consumer, host /
GUI thread), both cloned from one Arc.
Implementations§
Source§impl SnapshotSlot
impl SnapshotSlot
Sourcepub fn new() -> Arc<Self> ⓘ
pub fn new() -> Arc<Self> ⓘ
A fresh slot with its publish buffer pre-warmed to
SNAPSHOT_PREALLOC. Nothing is published yet, so Self::read
returns None until the first Self::publish.
Sourcepub fn publish(&self, write: impl FnOnce(&mut Vec<u8>) -> bool)
pub fn publish(&self, write: impl FnOnce(&mut Vec<u8>) -> bool)
Audio thread: publish the current snapshot. The buffer is
cleared before write runs (its capacity is retained, so a
steady state stays allocation-free), so write just fills it and
returns whether a snapshot exists - matching the
PluginLogic::snapshot_into contract, where a writer that only
extends must not accumulate across blocks. Never blocks - on
lock contention with a reader the publish is skipped and the
previous snapshot stands.
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether the plugin has ever published a snapshot. Cheap atomic read (no lock). Once true it stays true: a plugin’s decision to publish snapshots is a static capability, latched on the first successful publish.