MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / enqueue

Method enqueue

publication/code/chapter08/rbtree.rs:24–31  ·  view source on GitHub ↗
(&mut self, val: T)

Source from the content-addressed store, hash-verified

22 }
23
24 fn enqueue(&mut self, val: T) -> Result<(), String> {
25 if Self::len(&self) == self.cap {
26 return Err("No space available".to_string());
27 }
28 self.data.insert(0, val);
29
30 Ok(())
31 }
32
33 fn dequeue(&mut self) -> Option<T> {
34 if self.len() > 0 {

Callers 1

levelorderMethod · 0.45

Calls 2

to_stringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected