[][src]Struct lv2_core::prelude::FeatureCache

pub struct FeatureCache<'a> { /* fields omitted */ }

Cache for host features, used in the feature discovery stage.

At initialization time, a raw LV2 plugin receives a null-terminated array containing all requested host features. Obviously, this is not suited for safe Rust code and therefore, it needs an abstraction layer.

Internally, this struct contains a hash map which is filled the raw LV2 feature descriptors. Using this map, methods are defined to identify and retrieve features.

Implementations

impl<'a> FeatureCache<'a>[src]

pub unsafe fn from_raw(raw: *const *const LV2_Feature) -> Self[src]

Construct a cache from the raw features array.

It basically populates a hash map by walking through the array and then creates a FeatureContainer with it. However, this method is unsafe since it dereferences a C string to a URI. Also, this method should only be used with the features list supplied by the host since the soundness of the whole module depends on that assumption.

Safety

This method is unsafe since it needs to dereference the raw feature pointers.

pub fn contains<T: Feature>(&self) -> bool[src]

Evaluate whether this object contains the requested feature.

pub fn retrieve_feature<F: Feature, T: FromResolvedFeature<F>>(
    &mut self,
    class: ThreadingClass
) -> Result<T, MissingFeatureError>
[src]

Try to retrieve a feature.

If the feature is not found, this method will return None. Since the resulting feature object may have mutable access to the raw data, it will be removed from the cache to avoid aliasing.

You also have to provide the threading class of the feature you want to retrieve.

Trait Implementations

impl<'a> Clone for FeatureCache<'a>[src]

impl<'a> FeatureCollection<'a> for FeatureCache<'a>[src]

impl<'a> IntoIterator for FeatureCache<'a>[src]

type Item = FeatureDescriptor<'a>

The type of the elements being iterated over.

type IntoIter = Map<IntoIter<&'a CStr, *const c_void>, fn(_: (&'a CStr, *const c_void)) -> FeatureDescriptor<'a>>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<'a> RefUnwindSafe for FeatureCache<'a>

impl<'a> !Send for FeatureCache<'a>

impl<'a> !Sync for FeatureCache<'a>

impl<'a> Unpin for FeatureCache<'a>

impl<'a> UnwindSafe for FeatureCache<'a>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.