Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm very interested in this approach. sorry to be a pest, but could you point to the base traits/interfaces for using asynch without for example tokio? this might help me alot personally to get over some of my issues with rust.

edit: is it just future/await and nothing else?



This is the Future impl:

    trait Future {
        type Output;
        fn poll(&mut self, wake: fn()) -> Poll<Self::Output>;
    }

    enum Poll<T> {
        Ready(T),
        Pending,
    }
async functions get converted into -> impl Future<Output=original_return_type> automatically.

You poll() until it returns Ready.

wake() will notify you when it's ready to be polled again.

That's it.

Tokio and smol and these runtimes only exist to keep track of these, implement their own API, launch some threads, and run this event loop.


My understanding is you always need a runtime to play the async game -- something needs to drive the async flow. But there are others on the market, just not without the.. market domination... of tokio.

https://github.com/smol-rs/smol looks promising simply for being minimal

https://github.com/bytedance/monoio looks potentially easier to work with than tokio

https://github.com/DataDog/glommio is built around linux io_uring and seems somewhat promising for performance reasons.

I haven't played with any of these yet, because Tokio is unfortunately the path of least resistance. And a bit viral in how it's infected things.

But I'm planning on giving glommio at least a whirl.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: