Skip to content

Commit

Permalink
kernel: comment queue interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jul 18, 2018
1 parent a49c11c commit 2d26b08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/src/common/queue.rs
@@ -1,10 +1,19 @@
//! Interface for queue structure.

pub trait Queue<T> {
/// Returns true if there are any items in the queue, false otherwise.
fn has_elements(&self) -> bool;

/// Returns true if the queue is full, false otherwise.
fn is_full(&self) -> bool;

/// Returns how many elements are in the queue.
fn len(&self) -> usize;

/// Add a new element to the back of the queue.
fn enqueue(&mut self, val: T) -> bool;

/// Remove the element from the front of the queue.
fn dequeue(&mut self) -> Option<T>;

/// Remove all elements from the ring buffer.
Expand Down

0 comments on commit 2d26b08

Please sign in to comment.