mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-10-30 05:40:55 +00:00
embassy-sync: fix len calculation for zerocopy_channel
This commit is contained in:
parent
383ad72b63
commit
f3ed0c6026
@ -290,7 +290,15 @@ impl State {
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
self.len
|
||||
if !self.full {
|
||||
if self.back >= self.front {
|
||||
self.back - self.front
|
||||
} else {
|
||||
self.len + self.back - self.front
|
||||
}
|
||||
} else {
|
||||
self.len
|
||||
}
|
||||
}
|
||||
|
||||
fn is_full(&self) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user