Is promise like channel::oneshot implemented in std async?

Hello,

I'd like to be able to return a promise like as in javascript to be able to complete a job later.
It seems channel::oneshot from future-rs can do the job, but I can't find it in the std lib.

Is it implemented ? if not, is it planned ?

Thank you in advance for your help.

If you are using Tokio, you should be using the oneshot channel from Tokio: link. If you are outside of the async world, use either the mpsc channel from std, or the channel from crossbeam.

If you are not using async, use crossbeam's channels, they are better than std channels in prettry much every way.

It seems Promise like implementation is missing for async/await in rust.
I need to try tokio oneshot because future-rs oneshot is not compatible with async/await in rust.
So for now, async/await is unusable in rust for me as a newbie without a good promise implementation as in javascript.

You should spend some time reading The Rust Async Book.

The futures-rs oneshot is definitely compatible with async/await. What features of promises are you missing?

1 Like

My mistake : I wasn't returning the receiver!!
Thank you alice.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.