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

Method forward

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

Source from the content-addressed store, hash-verified

30 }
31
32 fn forward(&mut self, steps: i32) -> String {
33 let steps = steps as usize;
34 if self.idx + steps < self.his.len() {
35 self.idx += steps;
36 } else {
37 self.idx = self.his.len() - 1;
38 }
39 // println!("{:?} {:?}", self.his, self.idx);
40 self.his[self.idx].clone()
41 }
42}
43
44fn main() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected