Controller

Struct Controller 

Source
pub struct Controller { /* private fields */ }
Expand description

Message send controller object.

Because of features such as external message injection and implicit message sending from message boxes, it must be possible to send a message to associated receiveers without explicitly requiring a send object to exist in the graph. The message::send::Controller is intended as a central dispatcher for all sent messages, delivering a message to all associated receiveers without requiring the existence of a send object.

It can deliver messages via the usual receive_message() function, where the inlet index identifies a receiver name. The index for a receiver name can be determined with get_name_index(). This is useful for messages that must be scheduled in the global message queue and must then be dispatched via the receive_message() function.

Alternatively, a message can be sent to receivers using receive_message() with name and message arguments (instead of inlet index and message). Messages sent using this alternative will be sent right away (avoiding the message queue).

Implementations§

Source§

impl Controller

Source

pub fn new() -> Self

Create a new message::send::Controller

Source

pub fn receiver_exists(&self, receiver_name: &str) -> bool

Returns true if a receiver by that name is already registered, or false otherwise.

Source

pub fn get_name_index(&self, receiver_name: &str) -> Option<Index>

Returns the index to which the given receiver name is referenced. Used with receive_message(usize, &pd::Message<_>).

Source

pub fn receive_message<'pd, N>( &mut self, context: &mut Context<'pd>, name: &str, message: &Message<'pd, N>, )
where N: ArrayLength<Atom<'pd>>,

Sends the message on to all receivers with the given name

Source

pub fn send_message<'pd, N>( &mut self, context: &mut Context<'pd>, outlet_index: Index, message: &Message<'pd, N>, )
where N: ArrayLength<Atom<'pd>>,

Send a message to the given outlet index

Source

pub fn add_receiver( &mut self, receiver: RemoteMessageReceiver, ) -> Result<(), Error>

Add a receiver to this send controller

Source

pub fn remove_receiver(&mut self, receiver: RemoteMessageReceiver)

Remove a receiver from this send controller

Source

pub fn register_external_receiver(&mut self, receiver_name: &str)

Register an external message receiver with this send controller

Source

pub fn unregister_external_receiver(&mut self, _receiver_name: &str)

Unregister an external message receiver from this send controller

Trait Implementations§

Source§

impl Clone for Controller

Source§

fn clone(&self) -> Controller

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Controller

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Controller

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.