[−][src]Struct lv2_sys::LV2_State_Interface
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]
fn clone(&self) -> LV2_State_Interface
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for LV2_State_Interface
[src]
impl Debug for LV2_State_Interface
[src]
Auto Trait Implementations
impl RefUnwindSafe for LV2_State_Interface
impl Send for LV2_State_Interface
impl Sync for LV2_State_Interface
impl Unpin for LV2_State_Interface
impl UnwindSafe for LV2_State_Interface
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,