diff options
| author | kbleeke <[email protected]> | 2023-02-22 14:45:17 +0100 |
|---|---|---|
| committer | kbleeke <[email protected]> | 2023-02-22 14:45:17 +0100 |
| commit | 035de6f3ff7bae31dce25b55e822f75b46ebe047 (patch) | |
| tree | 17433add913f78d5d19c2a61b3248c203f445d07 /embassy-net/src/tcp.rs | |
| parent | f1a4db44c4c3f591df378190a6604d4547a37c25 (diff) | |
embassy-net: add flush to TcpSocket and TcpWriter as an inherent method
Diffstat (limited to 'embassy-net/src/tcp.rs')
| -rw-r--r-- | embassy-net/src/tcp.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index b9e494fc4..c3d8764b0 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -63,6 +63,10 @@ impl<'a> TcpWriter<'a> { | |||
| 63 | pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> { | 63 | pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> { |
| 64 | self.io.write(buf).await | 64 | self.io.write(buf).await |
| 65 | } | 65 | } |
| 66 | |||
| 67 | pub async fn flush(&mut self) -> Result<(), Error> { | ||
| 68 | self.io.flush().await | ||
| 69 | } | ||
| 66 | } | 70 | } |
| 67 | 71 | ||
| 68 | impl<'a> TcpSocket<'a> { | 72 | impl<'a> TcpSocket<'a> { |
| @@ -146,6 +150,10 @@ impl<'a> TcpSocket<'a> { | |||
| 146 | self.io.write(buf).await | 150 | self.io.write(buf).await |
| 147 | } | 151 | } |
| 148 | 152 | ||
| 153 | pub async fn flush(&mut self) -> Result<(), Error> { | ||
| 154 | self.io.flush().await | ||
| 155 | } | ||
| 156 | |||
| 149 | pub fn set_timeout(&mut self, duration: Option<Duration>) { | 157 | pub fn set_timeout(&mut self, duration: Option<Duration>) { |
| 150 | self.io.with_mut(|s, _| s.set_timeout(duration)) | 158 | self.io.with_mut(|s, _| s.set_timeout(duration)) |
| 151 | } | 159 | } |
