Decrements the counter by 1, if any, returning true if it hits zero
(&mut self)
| 4719 | } |
| 4720 | // Decrements the counter by 1, if any, returning true if it hits zero |
| 4721 | fn dec(&mut self) -> bool { |
| 4722 | if Some(0) == self.val { |
| 4723 | true |
| 4724 | } else { |
| 4725 | self.val = self.val.take().map(|i| i - 1); |
| 4726 | false |
| 4727 | } |
| 4728 | } |
| 4729 | } |
| 4730 | |
| 4731 | #[derive(Debug, Default)] |