mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 21:01:06 +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 {
|
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 {
|
fn is_full(&self) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user