aboutsummaryrefslogtreecommitdiff
path: root/embassy-hal-common/src/ring_buffer.rs
diff options
context:
space:
mode:
authorhuntc <[email protected]>2021-12-10 12:08:00 +1100
committerhuntc <[email protected]>2021-12-10 12:16:08 +1100
commit7256ff3e71ceea9091349b040a2ebc987aca590c (patch)
tree6f23c25b08c027db1dd133a7489b50661e08da7c /embassy-hal-common/src/ring_buffer.rs
parent60b7c50d8b02f92844287b150c5f504750846625 (diff)
Provides AsyncWrite with flush
As per Tokio and others, this commit provides a `poll_flush` method on `AsyncWrite` so that a best-effort attempt at wakening once all bytes are flushed can be made.
Diffstat (limited to 'embassy-hal-common/src/ring_buffer.rs')
-rw-r--r--embassy-hal-common/src/ring_buffer.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/embassy-hal-common/src/ring_buffer.rs b/embassy-hal-common/src/ring_buffer.rs
index 6829f62f5..fcad68bb1 100644
--- a/embassy-hal-common/src/ring_buffer.rs
+++ b/embassy-hal-common/src/ring_buffer.rs
@@ -125,5 +125,12 @@ mod tests {
125 let buf = rb.pop_buf(); 125 let buf = rb.pop_buf();
126 assert_eq!(1, buf.len()); 126 assert_eq!(1, buf.len());
127 assert_eq!(4, buf[0]); 127 assert_eq!(4, buf[0]);
128 rb.pop(1);
129
130 let buf = rb.pop_buf();
131 assert_eq!(0, buf.len());
132
133 let buf = rb.push_buf();
134 assert_eq!(4, buf.len());
128 } 135 }
129} 136}