[][src]Struct lv2_sys::LV2_State_Interface

#[repr(C)]pub struct LV2_State_Interface {
    pub save: Option<unsafe extern "C" fn(instance: LV2_Handle, store: LV2_State_Store_Function, handle: LV2_State_Handle, flags: u32, features: *const *const LV2_Feature) -> LV2_State_Status>,
    pub restore: Option<unsafe extern "C" fn(instance: LV2_Handle, retrieve: LV2_State_Retrieve_Function, handle: LV2_State_Handle, flags: u32, features: *const *const LV2_Feature) -> LV2_State_Status>,
}

LV2 Plugin State Interface.

When the plugin's extension_data is called with argument LV2_STATE__interface, the plugin MUST return an LV2_State_Interface structure, which remains valid for the lifetime of the plugin.

The host can use the contained function pointers to save and restore the state of a plugin instance at any time, provided the threading restrictions of the functions are met.

Stored data is only guaranteed to be compatible between instances of plugins with the same URI (i.e. if a change to a plugin would cause a fatal error when restoring state saved by a previous version of that plugin, the plugin URI MUST change just as it must when ports change incompatibly). Plugin authors should consider this possibility, and always store sensible data with meaningful types to avoid such problems in the future.

Fields

save: Option<unsafe extern "C" fn(instance: LV2_Handle, store: LV2_State_Store_Function, handle: LV2_State_Handle, flags: u32, features: *const *const LV2_Feature) -> LV2_State_Status>

Save plugin state using a host-provided store callback.

@param instance The instance handle of the plugin. @param store The host-provided store callback. @param handle An opaque pointer to host data which MUST be passed as the handle parameter to store if it is called. @param flags Flags describing desired properties of this save. These flags may be used to determine the most appropriate values to store. @param features Extensible parameter for passing any additional features to be used for this save.

The plugin is expected to store everything necessary to completely restore its state later. Plugins SHOULD store simple POD data whenever possible, and consider the possibility of state being restored much later on a different machine.

The handle pointer and store function MUST NOT be used beyond the scope of save().

This function has its own special threading class: it may not be called concurrently with any "Instantiation" function, but it may be called concurrently with functions in any other class, unless the definition of that class prohibits it (for example, it may not be called concurrently with a "Discovery" function, but it may be called concurrently with an "Audio" function. The plugin is responsible for any locking or lock-free techniques necessary to make this possible.

Note that in the simple case where state is only modified by restore(), there are no synchronization issues since save() is never called concurrently with restore() (though run() may read it during a save).

Plugins that dynamically modify state while running, however, must take care to do so in such a way that a concurrent call to save() will save a consistent representation of plugin state for a single instant in time.

restore: Option<unsafe extern "C" fn(instance: LV2_Handle, retrieve: LV2_State_Retrieve_Function, handle: LV2_State_Handle, flags: u32, features: *const *const LV2_Feature) -> LV2_State_Status>

Restore plugin state using a host-provided retrieve callback.

@param instance The instance handle of the plugin. @param retrieve The host-provided retrieve callback. @param handle An opaque pointer to host data which MUST be passed as the handle parameter to retrieve if it is called. @param flags Currently unused. @param features Extensible parameter for passing any additional features to be used for this restore.

The plugin MAY assume a restored value was set by a previous call to LV2_State_Interface.save() by a plugin with the same URI.

The plugin MUST gracefully fall back to a default value when a value can not be retrieved. This allows the host to reset the plugin state with an empty map.

The handle pointer and store function MUST NOT be used beyond the scope of restore().

This function is in the "Instantiation" threading class as defined by LV2. This means it MUST NOT be called concurrently with any other function on the same plugin instance.

Trait Implementations

impl Clone for LV2_State_Interface[src]

impl Copy for LV2_State_Interface[src]

impl Debug for LV2_State_Interface[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.