Character: Barbara
Barbara and Alan work at AmoolgeSoft where many teams are switching from Java to Rust. These teams have many different use cases and various adoption stories.
Barbara is tasked with writing a library for a custom protocol (SLOW) only in use at AmoogleSoft and enlists the help of Alan in doing so.
Alan and Barbara start by writing a parser which works on std::io::Read
and get their tests working with String
s. After this they contemplate the question of how to accept a TCP connection.
Alan asks Barbara what is the async equivalent is of std::io::Read
, and Barbara sighs and says that there isn't one.
AsyncRead
. Barbara decides not to talk about AsyncBufRead
for now.Barbara and Alan decide to use the future's AsyncRead
for no other reason other than it is not tied to a specific runtime. Barbara tells Alan not to worry, they can translate between the two.
Pin
?) they convert their parser to using AsyncRead
Alan, excited about the progress they've made, starts working on hooking this up to actual TCP streams.
Barbara helps abstract over TCP listener and TCP stream (TODO: code example)
AsyncRead
from their own crate and not the one from futuresSpawning tasks - there's no agnostic way to do that
agnostik
crate.They need timers
They need channels - after long searches and discussions on help channels, they learn about runtime agnostic implementations:
async-channel
, futures-rs channels, async-std/tokio's feature flagsThey get things working but it was hard. Some find the APIs harder to use than their runtime non-agnostic libs