embassy-net/read document return value Ok(0)

This commit is contained in:
dvdsk
2024-08-23 15:04:00 +02:00
parent 423e5d7655
commit acc26a076a

View File

@@ -79,6 +79,9 @@ impl<'a> TcpReader<'a> {
///
/// Returns how many bytes were read, or an error. If no data is available, it waits
/// until there is at least one byte available.
///
/// A return value of Ok(0) means that the socket was closed and is longer able to
/// accept bytes or that the buffer provided is empty.
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
self.io.read(buf).await
}
@@ -273,6 +276,9 @@ impl<'a> TcpSocket<'a> {
///
/// Returns how many bytes were read, or an error. If no data is available, it waits
/// until there is at least one byte available.
///
/// A return value of Ok(0) means that the socket was closed and is longer able to
/// accept bytes or that the buffer provided is empty.
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
self.io.read(buf).await
}