Add blocking_recv
method to oneshot::Receiver
#4319
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
E-easy
Call for participation: Experience needed to fix: Easy / not much
E-help-wanted
Call for participation: Help is requested to fix this issue.
M-sync
Module: tokio/sync
Is your feature request related to a problem? Please describe.
I would like to be able to send a value into a oneshot, and receive it either in an async context or a blocking context, to create an API which supports in both blocking and async contexts.
Describe the solution you'd like
mpsc::Receiver
andmpsc::UnboundedReceiver
haveblocking_recv
methods. It would be nice to see an equivalentblocking_recv
method added tooneshot::Receiver
.Describe alternatives you've considered
It would be interesting to instead simply expose the
crate::future::block_on
mechanism by which the existingblocking_recv
methods are implemented, and have a concept of "this async function doesn't aaactually rely on tokio and thus can be used in a non-async context in a blocking way with that wrapper."Additional context
It's for the
winit-main
crate if you're curious.The text was updated successfully, but these errors were encountered: