pub struct EitherQueue<L, R> { /* private fields */ }
Expand description
Representation of two queues in one.
Implementations§
Source§impl<L, R> EitherQueue<L, R>
impl<L, R> EitherQueue<L, R>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of nodes in both left and right queues combined.
let mut q = eitherq::EitherQueue::<&str, u32>::new();
q.push_left("elena");
q.push_left("chloe");
q.push_right(42);
assert_eq!(q.len(), 3);
pub fn left_len(&self) -> usize
pub fn right_len(&self) -> usize
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if both internal queues are empty.
let mut q = eitherq::EitherQueue::<&str, u32>::new();
assert_eq!(q.is_empty(), true);
q.push_left("charlie");
assert_eq!(q.is_empty(), false);
q.clear();
q.push_right(17);
assert_eq!(q.is_empty(), false);
Sourcepub fn is_left_empty(&self) -> bool
pub fn is_left_empty(&self) -> bool
Returns true
if the left queue is empty. Returns false
otherwise.
Sourcepub fn is_right_empty(&self) -> bool
pub fn is_right_empty(&self) -> bool
Returns true
if the right queue is empty. Returns false
otherwise.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears all elements from both queues.
let mut q = eitherq::EitherQueue::<&str, u32>::new();
q.push_left("sully");
q.push_right(11);
q.clear();
assert_eq!(q.len(), 0);
pub fn push(&mut self, n: Either<L, R>)
pub fn push_left(&mut self, n: L)
pub fn push_right(&mut self, n: R)
Trait Implementations§
Auto Trait Implementations§
impl<L, R> Freeze for EitherQueue<L, R>
impl<L, R> RefUnwindSafe for EitherQueue<L, R>where
L: RefUnwindSafe,
R: RefUnwindSafe,
impl<L, R> Send for EitherQueue<L, R>
impl<L, R> Sync for EitherQueue<L, R>
impl<L, R> Unpin for EitherQueue<L, R>
impl<L, R> UnwindSafe for EitherQueue<L, R>where
L: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more