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

Method add_car

1603-design-parking-system.rs:14–22  ·  view source on GitHub ↗
(&mut self, car_type: i32)

Source from the content-addressed store, hash-verified

12 }
13
14 fn add_car(&mut self, car_type: i32) -> bool {
15 let car_type = car_type as usize - 1;
16 if self.current.get(car_type).unwrap() + 1 > *self.max.get(car_type).unwrap() {
17 false
18 } else {
19 *self.current.get_mut(car_type).unwrap() += 1;
20 true
21 }
22 }
23}
24
25fn main() {

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected