Currently, the tricky_pipe::oneshot API allows Senders to be constructed from either an Arc<Receiver<T>> or a &'static Receiver<T>. This means that in order to use a Receiver, it must be either inside an Arcor in a &'static. This isn't great, as it's difficult for other crates, like MGNP, to write APIs that take a Receiver<T> as an argument without caring whether it's in an Arc or a static.
This branch changes the oneshot API so that a Receiver<T> is agnostic over the storage type and holds a *const Oneshot<T> plus a type-erased drop function, like the way Senders currently work. A Receiver<T> can now be constructed from either an Arc<Oneshot<T>> or a &'static Oneshot<T>>. Now, we can write APIs in MGNP that accept a Receiver<T>, without caring which storage type is used; this allows the user to pass in whatever oneshot storage they like.
Currently, the
tricky_pipe::oneshot
API allowsSender
s to be constructed from either anArc<Receiver<T>>
or a&'static Receiver<T>
. This means that in order to use aReceiver
, it must be either inside anArc
or in a&'static
. This isn't great, as it's difficult for other crates, like MGNP, to write APIs that take aReceiver<T>
as an argument without caring whether it's in anArc
or astatic
.This branch changes the
oneshot
API so that aReceiver<T>
is agnostic over the storage type and holds a*const Oneshot<T>
plus a type-eraseddrop
function, like the waySender
s currently work. AReceiver<T>
can now be constructed from either anArc<Oneshot<T>>
or a&'static Oneshot<T>>
. Now, we can write APIs in MGNP that accept aReceiver<T>
, without caring which storage type is used; this allows the user to pass in whatever oneshot storage they like.