MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add_line

Method add_line

atomic-core/src/change/credit.rs:633–645  ·  view source on GitHub ↗

Add a line credit (will merge with adjacent ranges if possible).

(&mut self, line: u64, credit: Credit)

Source from the content-addressed store, hash-verified

631
632 /// Add a line credit (will merge with adjacent ranges if possible).
633 pub fn add_line(&mut self, line: u64, credit: Credit) {
634 self.stats_cache = None; // Invalidate cache
635
636 // Try to extend the last range
637 if let Some(last) = self.ranges.last_mut() {
638 if last.try_extend(line, &credit) {
639 return;
640 }
641 }
642
643 // Create new range
644 self.ranges.push(CreditRange::single(line, credit));
645 }
646
647 /// Add a range of lines with the same credit.
648 pub fn add_range(&mut self, start: u64, end: u64, credit: Credit) {

Callers 6

test_file_credits_mixedFunction · 0.45
test_file_credits_statsFunction · 0.45

Calls 2

try_extendMethod · 0.80
pushMethod · 0.45

Tested by 6

test_file_credits_mixedFunction · 0.36
test_file_credits_statsFunction · 0.36