[−][src]Crate lv2rs_urid
A Rust re-implementation of the LV2 URID library.
This LV2 feature enables you to map URIs to numbers and reverse.
This is a frozen prototype and therefore, development of this crate will not continue here. Further development continues as rust-lv2.
Use
URID mapping is only possible in the instantiate
function of a plugin since there is no
guarantee that the required pointers live longer than the instantiate
function call. Here is
an example:
// import the required crates. extern crate lv2rs_core as core; extern crate lv2rs_urid as urid; use std::ffi::CStr; // A dummy plugin that doesn't actually do anything. struct UridPlugin {} impl core::Plugin for UridPlugin { fn instantiate( descriptor: &core::Descriptor, rate: f64, bundle_path: &CStr, features: Option<&core::FeaturesList> ) -> Option<Self> where Self: Sized { // Return `None` if there are no features. let features = features?; // Try to get the mapper and the un-mapper from the features list. let map = urid::Map::try_from_features(features)?; let unmap = urid::Unmap::try_from_features(features)?; // Create a URI, map it, and un-map it. let github_uri = CStr::from_bytes_with_nul(b"https://github.com\0").unwrap(); let github_urid = map.map(github_uri); let github_uri = unmap.unmap(github_urid); Some(Self {}) } // Blank implementations to keep the compiler quiet. fn connect_port(&mut self, _port: u32, _data: *mut ()) {} fn run(&mut self, _n_samples: u32) {} }
Modules
debug | Placeholder URID mapper for debugging purposes. |
uris |
Structs
CachedMap | Cached version of Map |
CachedUnmap | Cached version of Unmap |
Map | Struct for mapping URIs to URIDs. |
Unmap | Struct for mapping URIDs to URIs. |
Type Definitions
MapHandle | Type to describe pointers to map handles. |
URID | Type for describing URIDs. |
UnmapHandle | Type to describe pointers to unmap handles. |