Closed mcginty closed 3 years ago
One more thing I've realized about the signature fn on_full<F>(self, func: F) -> Self
:
This currently allows recipient.send(msg).on_full(foo).on_full(bar)
, which may sound like both foo
and bar
should be executed when the channel is full. But bar
will be never run under current design.
I've originally envisioned that fn_full()
& friends would return some different Result<(), DisconnectedError>
, preventing this. But perhaps that is kinda too elaborate? No strong opinion. BTW, if some DisconnectedError
is introduced, Recipient::stop()
could use it, too.
@strohel That's a good point, if only just because the full error is impossible after passing it through that function :). I'll make that change.
Implements a derivative of the API @strohel proposed in #20. Slightly modified to allow the
Recipient
to not need to holdactor_name
which didn't seem necessary.My proposed API looks like:
Which detaches it specifically from the
log
crate, and allows the user to specify things like the log level.Fixes #20.