xtra
xtra copied to clipboard
Re-focus public API on `Address` & `Mailbox` aka short-lived `Context`
As part of doing https://github.com/Restioson/xtra/pull/122, I started to form the following vision:
Chanshould be the core channel implementation of the library, #122 gets us most of the way thereSenderandReceiveronly really add an opinionated interfaces on top of it, plus reference counting- Neither
SendernorReceiverare publicly exposed, meaning I think they don't actually have to exist Sendercan be completely inlined intoAddress, removing an entire layer of indirectionReceivercan be promoted to a type calledMailboxthat could be publicly exposedContextwould be something that is constructed only temporarily for the invocation of a handler (I think we discussed this idea at some point)
Putting all of this together, we could realise an API like this:
let (mailbox, address) = Mailbox::bounded(5);
tokio::spawn(xtra::run(mailbox, MyActor::new()));
With run being implemented more or less like what we have today.
I think this makes sense!