pipecircuit 0.0.19

Correct. Robust. Fast. Portable. Pick four.
Documentation
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(super) enum ProjectionChange {
    Unchanged,
    Upsert,
    Remove { incarnation: u64 },
}

pub(super) fn projection_change<Value: Eq>(
    before: Option<(u64, &Value)>,
    after: Option<(u64, &Value)>,
) -> ProjectionChange {
    match (before, after) {
        (None, None) => ProjectionChange::Unchanged,
        (Some((old_incarnation, old)), Some((incarnation, value)))
            if old_incarnation == incarnation && old == value =>
        {
            ProjectionChange::Unchanged
        }
        (Some((..)) | None, Some((..))) => ProjectionChange::Upsert,
        (Some((incarnation, _)), None) => ProjectionChange::Remove { incarnation },
    }
}