aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordvdsk <[email protected]>2024-08-23 15:04:00 +0200
committerdvdsk <[email protected]>2024-08-23 15:04:00 +0200
commitacc26a076a44c4c64b960e259bb516a9bd636dfd (patch)
treefaa26c5979b844828077e4368d34810083692f96
parent423e5d7655d038ead9ad7f5f448cabbd0b330660 (diff)
embassy-net/read document return value Ok(0)
-rw-r--r--embassy-net/src/tcp.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 18200287e..62ee5cb66 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -79,6 +79,9 @@ impl<'a> TcpReader<'a> {
79 /// 79 ///
80 /// Returns how many bytes were read, or an error. If no data is available, it waits 80 /// Returns how many bytes were read, or an error. If no data is available, it waits
81 /// until there is at least one byte available. 81 /// until there is at least one byte available.
82 ///
83 /// A return value of Ok(0) means that the socket was closed and is longer able to
84 /// accept bytes or that the buffer provided is empty.
82 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> { 85 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
83 self.io.read(buf).await 86 self.io.read(buf).await
84 } 87 }
@@ -273,6 +276,9 @@ impl<'a> TcpSocket<'a> {
273 /// 276 ///
274 /// Returns how many bytes were read, or an error. If no data is available, it waits 277 /// Returns how many bytes were read, or an error. If no data is available, it waits
275 /// until there is at least one byte available. 278 /// until there is at least one byte available.
279 ///
280 /// A return value of Ok(0) means that the socket was closed and is longer able to
281 /// accept bytes or that the buffer provided is empty.
276 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> { 282 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
277 self.io.read(buf).await 283 self.io.read(buf).await
278 } 284 }