[−][src]Trait lv2::prelude::FeatureCollection
Convenience trait for feature collections.
The feature cache is only for temporary use; Once a feature is retrieved, it is removed from the cache. Therefore you need a way to properly store features.
You can simply create a struct with features as it's fields and derive FeatureCollection
for it. A procedural macro will then create a method that populates the struct from the cache, or returns None
if one of the required features is not in the cache.
An example using the few built-in features:
use lv2_core::plugin::*; use lv2_core::feature::*; #[derive(FeatureCollection)] struct MyCollection { live: IsLive, hardrt: Option<HardRTCapable>, }
Required methods
fn from_cache(
cache: &mut FeatureCache<'a>,
class: ThreadingClass
) -> Result<Self, MissingFeatureError>
cache: &mut FeatureCache<'a>,
class: ThreadingClass
) -> Result<Self, MissingFeatureError>
Populate a collection with features from the cache for the given threading class.
Implementations on Foreign Types
impl<'a> FeatureCollection<'a> for ()
[src]
pub fn from_cache(
_cache: &mut FeatureCache<'_>,
ThreadingClass
) -> Result<(), MissingFeatureError>
[src]
_cache: &mut FeatureCache<'_>,
ThreadingClass
) -> Result<(), MissingFeatureError>
Implementors
impl<'a> FeatureCollection<'a> for FeatureCache<'a>
[src]
pub fn from_cache(
cache: &mut FeatureCache<'a>,
ThreadingClass
) -> Result<FeatureCache<'a>, MissingFeatureError>
[src]
cache: &mut FeatureCache<'a>,
ThreadingClass
) -> Result<FeatureCache<'a>, MissingFeatureError>