Skip to content

Commit cf8274a

Browse files
fix(netwatch): non-allocating prefixes_major_equal, add last_updated with eq_ignoring_timestamp
1 parent 63409c8 commit cf8274a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

netwatch/src/interfaces.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,16 @@ fn prefixes_major_equal(a: impl Iterator<Item = IpNet>, b: impl Iterator<Item =
442442
true
443443
}
444444

445-
let a: Vec<_> = a.filter(is_interesting).collect();
446-
let b: Vec<_> = b.filter(is_interesting).collect();
447-
448-
a == b
445+
let mut a = a.filter(is_interesting);
446+
let mut b = b.filter(is_interesting);
447+
448+
loop {
449+
match (a.next(), b.next()) {
450+
(None, None) => return true,
451+
(Some(a), Some(b)) if a == b => continue,
452+
_ => return false,
453+
}
454+
}
449455
}
450456

451457
#[cfg(test)]

0 commit comments

Comments
 (0)