diff

Function diff 

Source
pub fn diff(
    old: &[AdapterSnapshot],
    new: &[AdapterSnapshot],
    timestamp: SystemTime,
) -> Vec<IpChange>
Expand description

Compares two adapter snapshots and returns a list of IP changes.

This is a pure function that detects which IP addresses were added or removed between two points in time. The comparison is done per-adapter by name.

§Arguments

  • old - The previous state of network adapters
  • new - The current state of network adapters
  • timestamp - The timestamp to assign to all detected changes

§Returns

A vector of IpChange events. The order is not guaranteed.

§Algorithm

For each adapter (matched by name):

  1. Find addresses in new but not in oldAdded
  2. Find addresses in old but not in newRemoved

Adapters that exist only in old have all their addresses marked as Removed. Adapters that exist only in new have all their addresses marked as Added.