at the moment there are two trait functions to send data.
send_data to prepare data for sending
poll_ready to poll the stream until the data is sent
This PR uses the async fn in traits feature to introduce the async fn send_data function in the SendStream trait.
Advantages:
Simplifying the h3_quinn crate
Removes error paths. h3_quinn panics if some functions are called while the boxed future is not ready. Users of h3_quinn+ h3 might be able to get this, for example when using RequestStream in a Mutex. (but I'm not sure)
Avoids boxing the future
Avoids cloning the data before sending
In h3 it is no longer possible to accidentally call send_data without poll_ready
at the moment there are two trait functions to send data.
send_data
to prepare data for sendingpoll_ready
to poll the stream until the data is sentThis PR uses the async fn in traits feature to introduce the
async fn send_data
function in theSendStream
trait.Advantages:
h3_quinn
crateh3_quinn
panics if some functions are called while the boxed future is not ready. Users ofh3_quinn
+h3
might be able to get this, for example when usingRequestStream
in a Mutex. (but I'm not sure)send_data
withoutpoll_ready
Disadvantages
Open:
Is it worth exploring this approach?