[][src]Trait lv2_state::State

pub trait State: Plugin {
    type StateFeatures: FeatureCollection<'static>;
    fn save(
        &self,
        store: StoreHandle,
        features: Self::StateFeatures
    ) -> Result<(), StateErr>;
fn restore(
        &mut self,
        store: RetrieveHandle,
        features: Self::StateFeatures
    ) -> Result<(), StateErr>; }

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 Features, 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>

The feature collection to populate for the save and restore methods.

Loading content...

Required methods

fn save(
    &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>

Restore the state of the plugin.

The properties you have previously written can be retrieved with the store handle.

Loading content...

Implementors

Loading content...