diff options
| author | Carl St-Laurent <[email protected]> | 2023-06-08 20:43:14 -0400 |
|---|---|---|
| committer | Carl St-Laurent <[email protected]> | 2023-06-08 20:43:14 -0400 |
| commit | 0915fb73b252b2b8ba6d3190c2537c3839246ec2 (patch) | |
| tree | ba1c4ddd7044ee95e268b8838a2bb72d0c478643 /embassy-sync/src | |
| parent | 4185c10bf83b96f015ef8d861b37555fff241061 (diff) | |
| parent | 2e0bc71c866d1844b2f069090861ca678576c7a1 (diff) | |
Merge branch 'master' into stm32g4-pll
Diffstat (limited to 'embassy-sync/src')
| -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, |
