diff options
Diffstat (limited to 'embassy-sync')
| -rw-r--r-- | embassy-sync/src/pipe.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-sync/src/pipe.rs b/embassy-sync/src/pipe.rs index ee27cdec8..db6ebb08b 100644 --- a/embassy-sync/src/pipe.rs +++ b/embassy-sync/src/pipe.rs | |||
| @@ -294,6 +294,16 @@ where | |||
| 294 | WriteFuture { pipe: self, buf } | 294 | WriteFuture { pipe: self, buf } |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /// Write all bytes to the pipe. | ||
| 298 | /// | ||
| 299 | /// This method writes all bytes from `buf` into the pipe | ||
| 300 | pub async fn write_all(&self, mut buf: &[u8]) { | ||
| 301 | while !buf.is_empty() { | ||
| 302 | let n = self.write(buf).await; | ||
| 303 | buf = &buf[n..]; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 297 | /// Attempt to immediately write some bytes to the pipe. | 307 | /// Attempt to immediately write some bytes to the pipe. |
| 298 | /// | 308 | /// |
| 299 | /// This method will either write a nonzero amount of bytes to the pipe immediately, | 309 | /// This method will either write a nonzero amount of bytes to the pipe immediately, |
