Module router

Module router 

Source
Expand description

Routers allow converting IPC channels to crossbeam channels. The RouterProxy provides various methods to register IpcReceiver<T>s. The router will then either call the appropriate callback or route the message to a crossbeam Sender<T> or Receiver<T>. You should use the global ROUTER to access the RouterProxy methods (via ROUTERโ€™s Deref for RouterProxy.

Structsยง

Router ๐Ÿ”’
Router runs in its own thread listening for events. Adds events to its IpcReceiverSet and listens for events using select().
RouterProxy
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
RouterProxyComm ๐Ÿ”’

Enumsยง

RouterHandler ๐Ÿ”’
RouterMsg ๐Ÿ”’

Staticsยง

ROUTER
Global object wrapping a RouterProxy. Add routes (add_typed_route), or convert IpcReceiver<T> to crossbeam channels (e.g. route_ipc_receiver_to_new_crossbeam_receiver)

Type Aliasesยง

RouterMultiHandler
Function to call when a new event is received from the corresponding receiver.
RouterOneShotHandler
Function to call the first time that a message is received from the corresponding receiver.
TypedRouterMultiHandler
Like RouterMultiHandler but includes the type that will be passed to the callback
TypedRouterOneShotHandler
Like RouterOneShotHandler but includes the type that will be passed to the callback