[−][src]Struct lv2_core::prelude::FeatureCache
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]
&mut self,
class: ThreadingClass
) -> Result<T, MissingFeatureError>
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]
fn clone(&self) -> FeatureCache<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> FeatureCollection<'a> for FeatureCache<'a>
[src]
fn from_cache(
cache: &mut FeatureCache<'a>,
_: ThreadingClass
) -> Result<Self, MissingFeatureError>
[src]
cache: &mut FeatureCache<'a>,
_: ThreadingClass
) -> Result<Self, MissingFeatureError>
impl<'a> IntoIterator for FeatureCache<'a>
[src]
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]
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<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
pub fn into_iter(self) -> I
[src]
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>,