embassy-net: add flush to TcpSocket and TcpWriter as an inherent method
This commit is contained in:
parent
f1a4db44c4
commit
035de6f3ff
@ -63,6 +63,10 @@ impl<'a> TcpWriter<'a> {
|
|||||||
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
|
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
|
||||||
self.io.write(buf).await
|
self.io.write(buf).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn flush(&mut self) -> Result<(), Error> {
|
||||||
|
self.io.flush().await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TcpSocket<'a> {
|
impl<'a> TcpSocket<'a> {
|
||||||
@ -146,6 +150,10 @@ impl<'a> TcpSocket<'a> {
|
|||||||
self.io.write(buf).await
|
self.io.write(buf).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn flush(&mut self) -> Result<(), Error> {
|
||||||
|
self.io.flush().await
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_timeout(&mut self, duration: Option<Duration>) {
|
pub fn set_timeout(&mut self, duration: Option<Duration>) {
|
||||||
self.io.with_mut(|s, _| s.set_timeout(duration))
|
self.io.with_mut(|s, _| s.set_timeout(duration))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user