[−][src]Trait lv2_state::State
A plugin extension that lets a plugins save and restore it's state.
This extension contains two new methods: save
and restore
. These are called by the host to save and restore the state of the plugin, which is done with a handle.
You can also add a feature collection to retrieve host features; It works just like the plugin's feature collection: You create a struct with multiple Feature
s, derive FeatureCollection
for it, and set the StateFeatures
type to it. Then, the framework will try to populate it with the features supplied by the host and pass it to the method.
Associated Types
type StateFeatures: FeatureCollection<'static>
Required methods
fn save(
&self,
store: StoreHandle,
features: Self::StateFeatures
) -> Result<(), StateErr>
&self,
store: StoreHandle,
features: Self::StateFeatures
) -> Result<(), StateErr>
Save the state of the plugin.
The storage is done with the store handle. You draft a property, write it using the property handle, and then commit it to the store.
fn restore(
&mut self,
store: RetrieveHandle,
features: Self::StateFeatures
) -> Result<(), StateErr>
&mut self,
store: RetrieveHandle,
features: Self::StateFeatures
) -> Result<(), StateErr>
Restore the state of the plugin.
The properties you have previously written can be retrieved with the store handle.