Trait runa_io_traits::buf::AsyncBufReadWithFd
source · pub unsafe trait AsyncBufReadWithFd: AsyncReadWithFd {
// Required methods
fn poll_fill_buf_until<'a>(
self: Pin<&'a mut Self>,
cx: &mut Context<'_>,
len: usize
) -> Poll<Result<()>>;
fn fds(&self) -> &[RawFd];
fn buffer(&self) -> &[u8] ⓘ;
fn consume(self: Pin<&mut Self>, amt: usize, amt_fd: usize);
// Provided methods
fn fill_buf_until(&mut self, len: usize) -> FillBufUtil<'_, Self> ⓘ
where Self: Unpin { ... }
fn poll_next_message<'a>(
self: Pin<&'a mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<Message<'a>>> { ... }
fn next_message<'a>(self: Pin<&'a mut Self>) -> NextMessageFut<'a, Self>
where Self: Sized { ... }
}
Expand description
Buffered I/O object for a stream of bytes with file descriptors.
Safety
See crate::AsyncReadWithFd
. Also, implementation cannot hold copies,
or use any of the file descriptors after they are consumed by the
caller.
Required Methods§
sourcefn poll_fill_buf_until<'a>(
self: Pin<&'a mut Self>,
cx: &mut Context<'_>,
len: usize
) -> Poll<Result<()>>
fn poll_fill_buf_until<'a>( self: Pin<&'a mut Self>, cx: &mut Context<'_>, len: usize ) -> Poll<Result<()>>
Reads enough data to return a buffer at least the given size.
sourcefn fds(&self) -> &[RawFd]
fn fds(&self) -> &[RawFd]
Pop 1 file descriptor from the buffer, return None if the buffer is empty. This takes shared references, mainly because we want to have the deserialized value borrow from the BufReader, but while deserializing, we also need to pop file descriptors. As a compromise, we have to pop file descriptors using a shared reference. Implementations would have to use a RefCell, a Mutex, or something similar.