pub struct RouterProxy { /* private fields */ }Expand description
A RouterProxy provides methods for talking to the router. Calling
new automatically spins up a router thread which
waits for events on its registered IpcReceiver<T>s. The RouterProxy’s
methods communicate with the running router thread to register new
IpcReceiver<T>’s
Implementations§
Source§impl RouterProxy
impl RouterProxy
pub fn new() -> RouterProxy
Sourcepub fn add_typed_route<T>(
&self,
receiver: IpcReceiver<T>,
callback: TypedRouterMultiHandler<T>,
)where
T: Serialize + for<'de> Deserialize<'de> + 'static,
pub fn add_typed_route<T>(
&self,
receiver: IpcReceiver<T>,
callback: TypedRouterMultiHandler<T>,
)where
T: Serialize + for<'de> Deserialize<'de> + 'static,
Add a new (receiver, callback) pair to the router, and send a wakeup message
to the router.
The callback is dropped when receiver’s channel disconnects.
Sourcepub fn add_typed_one_shot_route<T>(
&self,
receiver: IpcReceiver<T>,
callback: TypedRouterOneShotHandler<T>,
)where
T: Serialize + for<'de> Deserialize<'de> + 'static,
pub fn add_typed_one_shot_route<T>(
&self,
receiver: IpcReceiver<T>,
callback: TypedRouterOneShotHandler<T>,
)where
T: Serialize + for<'de> Deserialize<'de> + 'static,
Add a new (receiver, callback) pair to the router, and send a wakeup message
to the router.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Send a shutdown message to the router containing a ACK sender, send a wakeup message to the router, and block on the ACK. Calling it is idempotent, which can be useful when running a multi-process system in single-process mode.
Sourcepub fn route_ipc_receiver_to_crossbeam_sender<T>(
&self,
ipc_receiver: IpcReceiver<T>,
crossbeam_sender: Sender<T>,
)
pub fn route_ipc_receiver_to_crossbeam_sender<T>( &self, ipc_receiver: IpcReceiver<T>, crossbeam_sender: Sender<T>, )
A convenience function to route an IpcReceiver<T> to an existing Sender<T>.
Sourcepub fn route_ipc_receiver_to_new_crossbeam_receiver<T>(
&self,
ipc_receiver: IpcReceiver<T>,
) -> Receiver<T>
pub fn route_ipc_receiver_to_new_crossbeam_receiver<T>( &self, ipc_receiver: IpcReceiver<T>, ) -> Receiver<T>
A convenience function to route an IpcReceiver<T> to a Receiver<T>: the most common
use of a Router.