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§
source§impl<'d> Read for TcpReader<'d>
impl<'d> Read for TcpReader<'d>
source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
source§async fn read_exact(
&mut self,
buf: &mut [u8]
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8] ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moreAuto Trait Implementations§
impl<'a> Freeze for TcpReader<'a>
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