pub struct BufferedIo<'a, St, W, const READ_BUF_LIMIT: usize> {
pub io: &'a mut St,
pub read_buf: ReadBuf<READ_BUF_LIMIT>,
pub write_buf: W,
}
Expand description
Io type with internal buffering.
Fields§
§io: &'a mut St
mut reference of Io type that impl AsyncIo trait.
read_buf: ReadBuf<READ_BUF_LIMIT>
read buffer with const generic usize as capacity limit.
write_buf: W
generic type impl BufWrite trait as write buffer.
Implementations§
Source§impl<'a, St, W, const READ_BUF_LIMIT: usize> BufferedIo<'a, St, W, READ_BUF_LIMIT>
impl<'a, St, W, const READ_BUF_LIMIT: usize> BufferedIo<'a, St, W, READ_BUF_LIMIT>
Sourcepub fn new(io: &'a mut St, write_buf: W) -> Self
pub fn new(io: &'a mut St, write_buf: W) -> Self
construct a new buffered io with given Io and buf writer.
Sourcepub fn try_read(&mut self) -> Result<()>
pub fn try_read(&mut self) -> Result<()>
read until io blocked or read buffer is full and advance the length of it(read buffer).
Sourcepub async fn read(&mut self) -> Result<()>
pub async fn read(&mut self) -> Result<()>
check for io read readiness in async and do Self::try_read.
Sourcepub async fn drain_write(&mut self) -> Result<()>
pub async fn drain_write(&mut self) -> Result<()>
drain write buffer and flush the io.
Auto Trait Implementations§
impl<'a, St, W, const READ_BUF_LIMIT: usize> Freeze for BufferedIo<'a, St, W, READ_BUF_LIMIT>where
W: Freeze,
impl<'a, St, W, const READ_BUF_LIMIT: usize> RefUnwindSafe for BufferedIo<'a, St, W, READ_BUF_LIMIT>where
W: RefUnwindSafe,
St: RefUnwindSafe,
impl<'a, St, W, const READ_BUF_LIMIT: usize> Send for BufferedIo<'a, St, W, READ_BUF_LIMIT>
impl<'a, St, W, const READ_BUF_LIMIT: usize> Sync for BufferedIo<'a, St, W, READ_BUF_LIMIT>
impl<'a, St, W, const READ_BUF_LIMIT: usize> Unpin for BufferedIo<'a, St, W, READ_BUF_LIMIT>where
W: Unpin,
impl<'a, St, W, const READ_BUF_LIMIT: usize> !UnwindSafe for BufferedIo<'a, St, W, READ_BUF_LIMIT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more