ipc-channel
ipc-channel copied to clipboard
Add API to IpcReceiver that wraps the ROUTER integration
When I have a recv: IpcReceiver<T>, writing code like this feels like boilerplate:
ROUTER.add_route(
recv.to_opaque(),
Box::new(move |msg| {
do_something(
msg.to()
.expect("deserialization failed"),
);
}),
);
I would rather write something like recv.on_receive(Box::new(|msg| do_something(msg))), which does all of the opaque conversions for me and adds a route to the router.