scattered notes toward a real API
withoutboats opened this issue · comments
I think the Submission
future might not be suitable as the building block for a type that implements AsyncBufRead
.. it's too focused on ownership, representing a single concrete event. Probably want to pull out the polling and cancelling mechanism so that they can be used on a type that can be polled again and again.
I'm imagining a type called Ring
that could work similar to smol's Async
. It would have APIs like this:
pub struct Ring<IO, ..> {
...
}
impl<IO: Read + AsRawFd> AsyncBufRead for Ring<IO, ...> {
...
}
impl<IO: Read + AsRawFd> AsyncRead for Ring<IO, ...> {
... // defined in terms of AsyncBufRead
}
Additional parameters for buffer management and reactor management (hopefully with good default types).
So you'd have Ring<File>
and Ring<TcpStream>
etc.