pub struct Graph { /* private fields */ }Expand description
A graph is a lightweight connection to libmapper’s distributed graph. You can use a graph to create maps and query the state of the graph.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn poll_and_block(&self, time: Duration)
pub fn poll_and_block(&self, time: Duration)
Poll the graph and block for the specified amount of time
Use this instead of sleeping in a loop
Sourcepub fn subscribe(&self, device: Option<Device<'_>>, types: &[mpr_type])
pub fn subscribe(&self, device: Option<Device<'_>>, types: &[mpr_type])
Tells the graph to subscribe to receive updates for the specified device and types.
If the device is None, the graph will automatically subscribe to all devices as they become visible.
types allows filtering the objects of interest. For example, to only listen for information about signals, use [mpr_type::MPR_SIG].
This function must be called before functions like get_devices will return any results.
Sourcepub fn get_devices<'a>(&'a self) -> Vec<Device<'a>>
pub fn get_devices<'a>(&'a self) -> Vec<Device<'a>>
Get all devices currently visible to the graph.
If subscribe has not been called, this function will not be able to see any devices (except those owned by this graph via Device::create_from_graph).