How could I do to support async for rustls?
โ Rust ๐ 2026-01-11 ๐ค surdeus ๐๏ธ 1Basically, I want to create a TlsStream struct but prefer not to use crates like tokio_rustls. I want to explore how to manually implement AsyncRead and AsyncWrite for it. I tried using AI to generate code, and it came up with an approach like this*:
Create an adapter that implements Read and Write (returning std::io::Result<Poll>). For reading/writing plaintext, use rustls::Connection::{reader.read, writer.write}; for reading/writing encrypted text, use read_tls/write_tls with the adapter.
Iโve been trying in this direction for almost an entire day, and I felt like the code was extremely messyโeither ending up in infinite loops or failing to close connections, with a bunch of issues. How can I properly add async support?
1 post - 1 participant
๐ท๏ธ Rust_feed