Relative Content

Tag Archive for rustrust-tokio

What are the differences between tokio_util::StreamExt and futures::StreamExt?

While developing my web application, I utilized the tokio_util::StreamExt::then method to manage the request stream. Surprisingly, I observed that replacing tokio_util::StreamExt with futures::StreamExt ,my code still worked. I’m curious about the underlying reason for this occurrence.
To gain further insight, I attempted to consult the documentation at docs.rs/tokio_util; however, I found it to be quite challenging to comprehend. Could someone lend me a hand in understanding this matter?

Migrating process to tokio

I’ve got a process that analyzes data as it comes into a network connection. These frames are about 128 bytes, and the processing takes about 1.8us. While that might seem plenty fast, the sheer number of frames to be evaluated is enough to evaluate how to multi-thread the work.

How to access request component using Poem

I’m trying to access the headers, url path, query parameters and other http information associated with a request received by my poem server. The server uses poem-openapi and tokio to receive and process requests. Here’s the driving code from main.rs:

Is AsyncReadExt::read cancel safe?

I am wondering if Tokio’s AsyncReadExt::read method is cancel safe.
More specifically, say I invoke, e.g., socket.read(&mut my_buf) from within a tokio::select, but my invocation gets cancelled before returning. Can I trust that no bytes were read from socket, i.e., that socket is in the same state as before I called socket.read?