Try to extend this range with another credit. Returns true if the extension was successful (credits match and lines are adjacent).
(&mut self, line: u64, credit: &Credit)
| 582 | /// |
| 583 | /// Returns true if the extension was successful (credits match and lines are adjacent). |
| 584 | pub fn try_extend(&mut self, line: u64, credit: &Credit) -> bool { |
| 585 | if line == self.end_line + 1 && self.credit == *credit { |
| 586 | self.end_line = line; |
| 587 | true |
| 588 | } else { |
| 589 | false |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | impl fmt::Display for CreditRange { |