pub struct StoreHandle<'a> { /* private fields */ }Expand description
Property storage handle.
This handle can be used to store the properties of a plugin. It uses the atom system to encode the properties and is backed by a storage callback function.
The written properties a buffered and flushed when requested. Create new properties by calling draft and write them like any other atom. Once you are done, you can commit your properties by calling commit_all or commit. You have to commit manually: Uncommitted properties will be discarded when the handle is dropped.
Implementations§
Source§impl<'a> StoreHandle<'a>
impl<'a> StoreHandle<'a>
Sourcepub fn new(store_fn: LV2_State_Store_Function, handle: LV2_State_Handle) -> Self
pub fn new(store_fn: LV2_State_Store_Function, handle: LV2_State_Handle) -> Self
Create a new store handle.
Sourcepub fn draft<K: ?Sized>(
&mut self,
property_key: URID<K>,
) -> StatePropertyWriter<'_>
pub fn draft<K: ?Sized>( &mut self, property_key: URID<K>, ) -> StatePropertyWriter<'_>
Draft a new property.
This will return a new handle to create a property. Once the property is completely written, you can commit it by calling commit or commit_all. Then, and only then, it will be saved by the host.
If you began to write a property and don’t want the written things to be stored, you can discard it with discard or discard_all.
Sourcepub fn commit_pair<K: ?Sized>(
store_fn: LV2_State_Store_Function,
handle: LV2_State_Handle,
key: URID<K>,
space: SpaceElement,
) -> Result<(), StateErr>
pub fn commit_pair<K: ?Sized>( store_fn: LV2_State_Store_Function, handle: LV2_State_Handle, key: URID<K>, space: SpaceElement, ) -> Result<(), StateErr>
Internal helper function to store a property.
Sourcepub fn commit_all(&mut self) -> Result<(), StateErr>
pub fn commit_all(&mut self) -> Result<(), StateErr>
Commit all created properties.
This will also clear the property buffer.
Sourcepub fn commit<K: ?Sized>(
&mut self,
key: URID<K>,
) -> Option<Result<(), StateErr>>
pub fn commit<K: ?Sized>( &mut self, key: URID<K>, ) -> Option<Result<(), StateErr>>
Commit one specific property.
This method returns None if the requested property was not marked for commit, Some(Ok(())) if the property was stored and Some(Err(_)) if an error occured while storing the property.
Sourcepub fn discard_all(&mut self)
pub fn discard_all(&mut self)
Discard all drafted properties.