Function merge

Source
pub fn merge(into: &mut UserData, incoming: UserData) -> Merge
Expand description

Folds one set of user data into another.

Merging, never replacing. Someone restoring half a backup wants their two halves, not the older one; and an import that emptied what was already there would be the one operation in this program capable of losing everything at once.

The rule is the same everywhere: the record written last wins, and the one that lost is reported rather than dropped in silence. Play counters take the larger of the two, since a count is a total and neither side ever counted the other’s listens. Recent listening events are merged as a multiset of their complete values: simultaneous identical events keep their multiplicity, and reimporting a backup does not append them again. Relink history remains an audit trail; importing it never replays reattachment or undo commands. Native-player profiles are imported only when absent locally: an import never rewinds an existing device checkpoint, even if its timestamp is older.