MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / back

Method back

1472-design-browser-history.rs:21–30  ·  view source on GitHub ↗
(&mut self, steps: i32)

Source from the content-addressed store, hash-verified

19 }
20
21 fn back(&mut self, steps: i32) -> String {
22 let steps = steps as usize;
23 if self.idx < steps {
24 self.idx = 0;
25 } else {
26 self.idx -= steps;
27 }
28 // println!("{:?} {:?}", self.his, self.idx);
29 self.his[self.idx].clone()
30 }
31
32 fn forward(&mut self, steps: i32) -> String {
33 let steps = steps as usize;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected