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

Method enqueue

publication/code/chapter08/avl.rs:30–37  ·  view source on GitHub ↗
(&mut self, val: T)

Source from the content-addressed store, hash-verified

28 }
29
30 fn enqueue(&mut self, val: T) -> Result<(), String> {
31 if Self::len(&self) == self.cap {
32 return Err("No space available".to_string());
33 }
34 self.data.insert(0, val);
35
36 Ok(())
37 }
38
39 fn dequeue(&mut self) -> Option<T> {
40 if self.len() > 0 {

Callers 2

levelorderMethod · 0.45
levelorderFunction · 0.45

Calls 2

to_stringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected