Graph

Struct Graph 

Source
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

Source

pub fn create() -> Graph

Source§

impl Graph

Source

pub fn poll(&self)

Poll the graph without blocking

Source

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

Source

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.

Source

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).

Trait Implementations§

Source§

impl Drop for Graph

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Graph

Source§

impl Sync for Graph

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.