pub struct ReadHalf { /* private fields */ }Expand description
The reading end of one side. Dropping it tells the peer’s writer that nothing more will be read.
Implementations§
Source§impl ReadHalf
impl ReadHalf
pub fn id(&self) -> StreamId
Sourcepub fn try_read(&self, buf: &mut [u8]) -> Result<usize>
pub fn try_read(&self, buf: &mut [u8]) -> Result<usize>
Read what is there now. Ok(0) is clean end of stream;
Error::WouldBlock means nothing yet.
Sourcepub fn try_read_exact(&self, buf: &mut [u8]) -> Result<()>
pub fn try_read_exact(&self, buf: &mut [u8]) -> Result<()>
Read the complete buffer atomically. When it is not all available,
returns Error::WouldBlock without consuming a prefix.
Sourcepub fn blocking_read(&self, buf: &mut [u8]) -> Result<usize>
pub fn blocking_read(&self, buf: &mut [u8]) -> Result<usize>
Park until something can be read, then read it. Ok(0) is clean
end of stream. Blocks the thread; an async runtime uses AsyncRead.
Sourcepub fn blocking_read_chunk(&self, max: usize) -> Result<Bytes>
pub fn blocking_read_chunk(&self, max: usize) -> Result<Bytes>
Up to max bytes as one owned chunk; empty at clean end of stream.
Sourcepub fn wait_readable_timeout(&self, timeout: Duration) -> Result<bool>
pub fn wait_readable_timeout(&self, timeout: Duration) -> Result<bool>
The same wait, bounded: false is the timeout and nothing else.
Sourcepub fn wait_readable(&self) -> Result<()>
pub fn wait_readable(&self) -> Result<()>
Park until a read would make progress or the direction ended.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReadHalf
impl !UnwindSafe for ReadHalf
impl Freeze for ReadHalf
impl Send for ReadHalf
impl Sync for ReadHalf
impl Unpin for ReadHalf
impl UnsafeUnpin for ReadHalf
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