ipc-channel icon indicating copy to clipboard operation
ipc-channel copied to clipboard

Add API to IpcReceiver that wraps the ROUTER integration

Open jdm opened this issue 5 years ago • 0 comments

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.

jdm avatar May 01 '20 15:05 jdm