pub struct Map { /* private fields */ }Expand description
A directional connection between multiple signals. Changes to input signals will affect output signals.
§Examples
Create a map between two signals:
use std::thread;
use std::time::Duration;
use libmapper_rs::graph::Map;
use libmapper_rs::signal::Signal;
fn create_map(sig_a: &Signal, sig_b: &Signal) -> Map {
let map = Map::create(sig_a, sig_b);
loop {
if map.is_ready() {
break;
}
thread::sleep(Duration::from_millis(10));
}
map
}Implementations§
Source§impl Map
impl Map
Sourcepub fn create(src: &Signal, dst: &Signal) -> Map
pub fn create(src: &Signal, dst: &Signal) -> Map
Create a new map between two signals. This does not actually create the map in the graph, push must be called to let the rest of the graph know about the map.
Sourcepub fn push(&self)
pub fn push(&self)
Publish this map to the distributed graph.
After calling this function and once is_ready returns true, the map is active.
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Returns true once the map has been published and is active.
Otherwise, returns false.
Sourcepub fn set_expr(&self, expression: &str)
pub fn set_expr(&self, expression: &str)
Set the expression used to map the values from the source(s) to the destination.
This is a helper function wrapping MapperObject::set_property_str
Trait Implementations§
Source§impl AsMprObject for Map
impl AsMprObject for Map
fn as_mpr_object(&self) -> *mut c_void
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl !Send for Map
impl !Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<A> MapperObject for Awhere
A: AsMprObject,
impl<A> MapperObject for Awhere
A: AsMprObject,
Source§fn set_property<T>(&self, property: mpr_prop, value: T)where
T: MappableType,
fn set_property<T>(&self, property: mpr_prop, value: T)where
T: MappableType,
Set a property on this object to a numerical value
Source§fn set_property_str(&self, property: mpr_prop, value: &str)
fn set_property_str(&self, property: mpr_prop, value: &str)
Set a property on this object to a string value
Source§fn get_property<T>(&self, property: mpr_prop) -> Result<T, PropertyError>where
T: MappableType + Copy,
fn get_property<T>(&self, property: mpr_prop) -> Result<T, PropertyError>where
T: MappableType + Copy,
Get the value of a property by it’s key from this object.
If the property does not exist, or if the type is not matched, this function will return an error.
Source§fn get_property_str(&self, property: mpr_prop) -> Result<String, PropertyError>
fn get_property_str(&self, property: mpr_prop) -> Result<String, PropertyError>
Get the value of a string property by it’s key from this object.
If the property does not exist, or if the type is not matched, this function will return an error.
Source§fn set_custom_property<T>(&self, property: &str, value: T, publish: bool)where
T: MappableType,
fn set_custom_property<T>(&self, property: &str, value: T, publish: bool)where
T: MappableType,
Set a user-defined property to the specified value.
The property is identified by a unique, case-sensitive string key. Read more