Home/Languages/Catching up with async Rust
Languages

Catching up with async Rust

In December 2023, a minor miracle happened: async fn in traits shipped. As of Rust 1.39, we already had free-standing async functions:  pub async fn read_hosts () -> eyre :: Result < Vec < u8 >> { // etc. } …and async functions in impl blocks:  impl HostReader { pub async fn read_hosts ( & self ) -> eyre :: Result < Vec < u8 >> { // etc. } } But we did not have async functions in traits:

Catching up with async Rust

In December 2023, a minor miracle happened: async fn in traits shipped. As of Rust 1.39, we already had free-standing async functions:  pub async fn read_hosts () -> eyre :: Result < Vec < u8 >> { // etc. } …and async functions in impl blocks:  impl HostReader { pub async fn read_hosts ( & self ) -> eyre :: Result < Vec < u8 >> { // etc. } } But we did not have async functions in traits:

AWAmos Wenger
Written by
fasterthanli.me

Writes for fasterthanli.me. Part of the Tech Report engineering index.

All articles by Amos Wenger →