Meet Osaka, a Rust async for explicit, well-defined code that doesn’t take up too much space

Share
  • February 8, 2019

Rust is a great programming language if you’re looking for something without a lot of runtime dependencies and a well-developed ecosystem. However, for developers looking to write embedded async applications on constrained devices, the preexisting Tokio sometimes isn’t the best choice. That’s where Osaka comes into play.

Osaka is designed for continuations, not combinators. It gives developers a more readable flow while maintaining a smaller footprint. Inspired by Go and the Clay programming languages, Osaka is an attempt to make async more simplistic.

Asynchronous coding makes it possible for applications to wait for resources. While some developers might use threads, they do take a fair amount of space with their executable stack.

Embedded devices are generally small and they spend an awful lot of time hanging around and waiting for network packets. Async is the ideal solution, since they are much more lightweight than threads and they can wait until the CPU resources appear.

To be fair Rust already has an async option: Tokio. While Tokio does provided a solid platform for fast and reliable network apps, there is room for improvement for embedded devices.

Things are easy to understand in Osaka. All behavior is well defined and there are no implicit dependencies. Everything is explicit, from the code, the behavior, and even the errors! Basically, Osaka was designed to make things more unambiguous to the developer. Sometimes the simpler approach is the easiest!

Designed for the “if it compiles, ship it” workflow, Osaka has a few main differences from async/await. There’s no task queue, no hidden singleton task registry, and considerably less magic.

Probably the most impressive thing about Osaka (aside from the castle) is that it can drastically reduce the binary size and memory usage. Get rid of racing bugs and dangling resources, simplify your code, and fit your async apps on embedded devices.

SEE ALSO: Speedy Rust framework for web apps burns through the sky

Getting Osaka

Osaka is available on GitHub. In theory, it can be ported to bare metal. More information about this Rust async for embedded devices is available here.

The post Meet Osaka, a Rust async for explicit, well-defined code that doesn’t take up too much space appeared first on JAXenter.

Source : JAXenter