如何使用Tokio编写异步方法?

我正在尝试编写一个库,该库将连接到远程服务器并交换数据。我在C ++中使用Boost :: Asio做到了这一点,并且正试图用Rust做同样的事情。

One of the problems I have is mapping concepts from Asio, like async_write/read to Tokio, starting with the fact that seemingly all Tokio examples demand that I replace my main() with an async main(), while I would like to encapsulate all my async code in structures and associated implementations.

Is it possible to use Tokio without replacing main()? Is mio perhaps the only way?