Struct embassy_net::tcp::TcpReader
source · pub struct TcpReader<'a> { /* private fields */ }
Expand description
The reader half of a TCP socket.
Implementations§
source§impl<'a> TcpReader<'a>
impl<'a> TcpReader<'a>
sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read data from the socket.
Returns how many bytes were read, or an error. If no data is available, it waits until there is at least one byte available.
sourcepub async fn read_with<F, R>(&mut self, f: F) -> Result<R, Error>
pub async fn read_with<F, R>(&mut self, f: F) -> Result<R, Error>
Call f
with the largest contiguous slice of octets in the receive buffer,
and dequeue the amount of elements returned by f
.
If no data is available, it waits until there is at least one byte available.
sourcepub fn recv_capacity(&self) -> usize
pub fn recv_capacity(&self) -> usize
Return the maximum number of bytes inside the transmit buffer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TcpReader<'a>
impl<'a> !Send for TcpReader<'a>
impl<'a> !Sync for TcpReader<'a>
impl<'a> Unpin for TcpReader<'a>
impl<'a> !UnwindSafe for TcpReader<'a>
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