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

Method enqueue

publication/code/chapter08/binary_tree.rs:29–36  ·  view source on GitHub ↗
(&mut self, val: T)

Source from the content-addressed store, hash-verified

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