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

Method enqueue

publication/code/chapter09/word_ladder.rs:21–28  ·  view source on GitHub ↗
(&mut self, val: T)

Source from the content-addressed store, hash-verified

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

Callers 1

word_ladderFunction · 0.45

Calls 2

to_stringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected