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
impl Controller
Sourcepub fn receiver_exists(&self, receiver_name: &str) -> bool
pub fn receiver_exists(&self, receiver_name: &str) -> bool
Returns true if a receiver by that name is already registered, or
false otherwise.
Sourcepub fn get_name_index(&self, receiver_name: &str) -> Option<Index>
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<_>).
Sourcepub fn receive_message<'pd, N>(
&mut self,
context: &mut Context<'pd>,
name: &str,
message: &Message<'pd, N>,
)where
N: ArrayLength<Atom<'pd>>,
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
Sourcepub fn send_message<'pd, N>(
&mut self,
context: &mut Context<'pd>,
outlet_index: Index,
message: &Message<'pd, N>,
)where
N: ArrayLength<Atom<'pd>>,
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
Sourcepub fn add_receiver(
&mut self,
receiver: RemoteMessageReceiver,
) -> Result<(), Error>
pub fn add_receiver( &mut self, receiver: RemoteMessageReceiver, ) -> Result<(), Error>
Add a receiver to this send controller
Sourcepub fn remove_receiver(&mut self, receiver: RemoteMessageReceiver)
pub fn remove_receiver(&mut self, receiver: RemoteMessageReceiver)
Remove a receiver from this send controller
Sourcepub fn register_external_receiver(&mut self, receiver_name: &str)
pub fn register_external_receiver(&mut self, receiver_name: &str)
Register an external message receiver with this send controller
Sourcepub fn unregister_external_receiver(&mut self, _receiver_name: &str)
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
impl Clone for Controller
Source§fn clone(&self) -> Controller
fn clone(&self) -> Controller
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more