Add SendFut::into_inner.#126
Conversation
|
This looks good to me! I initially turned my nose up at the name |
|
At least now, building a timeout on top is a relatively trivial job. In terms of implementing that, I think the most lightweight and sensible solution - based on a cursory reading - is to pull in the |
|
Yep, it mostly just depends on how you want the API to look either pub async fn send_timeout_async(&self, message: T, dur: Duration) -> Result<(), ErrorType>;B) having the function return some concrete type that implements pub fn send_timeout_async(&self, message: T, dur: Duration) -> TimeoutFut;In the case of |
|
I think B is probably the way to go. It's an underrated thing, but being able to name the type of a feature is occasionally very important, particularly if you're building an API on top of the thing. |
|
@zesterer Do you want these as separate MRs, or should I add the timeout functions here in this MR? |
|
It looks like the actual implementation of the When writing tests, for the implementation, there is a panic coming from the |
|
Are there any updates to this? I'm looking to use flume in kameo, but sadly this feature is a bit of a blocker for me. |
| } | ||
|
|
||
| /// Consume `self` returning the queued value if it has not yet been sent. | ||
| pub fn into_inner(mut self) -> Option<T> { |
There was a problem hiding this comment.
Could this be &mut self, or is it intentionally consuming the SendFut?
There was a problem hiding this comment.
I think it can be made to accept &mut self, yes.
This is the first step for adding a
send_timeout_asyncandsend_deadling_async.This provides the ability to consume a
SendFutreturning its contained value if the value has not yet been sent.