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

Method add_rear

code/chapter03/palindrome_checker.rs:15–22  ·  view source on GitHub ↗
(&mut self, val: T)

Source from the content-addressed store, hash-verified

13 }
14
15 fn add_rear(&mut self, val: T) -> Result<(), String> {
16 if self.size() == self.cap {
17 return Err("No space avaliabl".to_string());
18 }
19 self.data.insert(0, val);
20
21 Ok(())
22 }
23
24 fn remove_front(&mut self) -> Option<T> {
25 if self.size() > 0 {

Callers 1

palindrome_checkerFunction · 0.45

Calls 3

sizeMethod · 0.45
to_stringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected