News for hackers. Stuff that matters.
Re:Tokio 1.0 – async runtime for Rust by otachack on Wednesday December 23, 2020 @02:01PM (#25520838)
Congrats! I've fallen off Rust due to pivoting at work plus trying other languages but I'm intrigued again by Tokio's announcement. I'll be trying out your tutorial soon!
Re:Tokio 1.0 – async runtime for Rust by edulix on Wednesday December 23, 2020 @02:28PM (#25521142)
what did you pivot to and why, if you don't mind me asking?
Re:Tokio 1.0 – async runtime for Rust by kiadimoondi on Wednesday December 23, 2020 @02:51PM (#25521408)
Can't speak for the commenter, but I used to work for a team couple years ago that used rust and tokio extensively, and some projects were just not a good fit. At the time, futures were well fleshed out but the community hadn't caught up, so we were lacking a futures-compatible postgres and redis client. We wrote the redis client ourselves, and for the main project using rust that was sufficient. But for postgres, that was a show stopper for any other projects we were working on. So we ended up deciding between typescript and go for those.
Re:Tokio 1.0 – async runtime for Rust by johnsoft on Wednesday December 23, 2020 @03:52PM (#25522091)
Just curious, did you consider wrapping the existing sync clients with something like spawn_blocking[1]? If so, what tradeoffs did you find?

[1]: https://docs.rs/tokio/1.0.0/tokio/task/fn.spawn_blocking.htm...

Re:Tokio 1.0 – async runtime for Rust by ibraheemdev on Wednesday December 23, 2020 @03:19PM (#25521713)
The ecosystem has moved forward a lot since then. Pretty much all IO libraries provide an asynchronous API now.
Re:Tokio 1.0 – async runtime for Rust by sanxiyn on Wednesday December 23, 2020 @03:27PM (#25521801)
Note: now tokio-postgres works fine.
Re:Tokio 1.0 – async runtime for Rust by echelon on Wednesday December 23, 2020 @02:37PM (#25521249)
Your comment was "dead", but I see nothing wrong with it and vouched for it. This is a valid question asked earnestly.

I'd honestly like to know too.

Re:Tokio 1.0 – async runtime for Rust by brobinson on Wednesday December 23, 2020 @03:58PM (#25522142)
The tokio tutorial is good, but it needs an example of spinning off multiple (2-3 or more) tasks which run forever. I ended up using spawn() multiple times and having the main thread just sleep in a loop and not using #[tokio::main] because I couldn't figure it out.
Re:Tokio 1.0 – async runtime for Rust by aliceryhl on Wednesday December 23, 2020 @04:05PM (#25522222)
You can await std::future::pending, or you can just await the Join Handles returned by the calls to spawn.
Re:Tokio 1.0 – async runtime for Rust by brobinson on Wednesday December 23, 2020 @05:12PM (#25522870)
Thanks for the tip!