Perp: Remove EventQueue::empty() - is_empty() exists as well

This commit is contained in:
Christian Kamm 2023-01-20 13:26:33 +01:00
parent 1b4140c078
commit 549d9a8108
1 changed files with 3 additions and 7 deletions

View File

@ -44,10 +44,6 @@ impl EventQueue {
self.header.count() == self.buf.len()
}
pub fn empty(&self) -> bool {
self.header.count() == 0
}
pub fn push_back(&mut self, value: AnyEvent) -> std::result::Result<(), AnyEvent> {
if self.full() {
return Err(value);
@ -63,21 +59,21 @@ impl EventQueue {
}
pub fn peek_front(&self) -> Option<&AnyEvent> {
if self.empty() {
if self.is_empty() {
return None;
}
Some(&self.buf[self.header.head()])
}
pub fn peek_front_mut(&mut self) -> Option<&mut AnyEvent> {
if self.empty() {
if self.is_empty() {
return None;
}
Some(&mut self.buf[self.header.head()])
}
pub fn pop_front(&mut self) -> Result<AnyEvent> {
require!(!self.empty(), MangoError::SomeError);
require!(!self.is_empty(), MangoError::SomeError);
let value = self.buf[self.header.head()];