pipecircuit 0.0.11

Correct. Robust. Fast. Portable.
Documentation
use super::{SlotSet, StableSlot};

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[must_use]
pub enum SlotSetRemoveOutcome {
    Removed { slot: StableSlot },
    Absent { slot: StableSlot },
}

impl SlotSet {
    pub fn remove(&mut self, slot: StableSlot) -> SlotSetRemoveOutcome {
        let removed = self.0.remove(slot.value());
        if removed {
            SlotSetRemoveOutcome::Removed { slot }
        } else {
            SlotSetRemoveOutcome::Absent { slot }
        }
    }

    pub(in crate::storage::warp_table::secondary_index) fn commit_prepared_remove(
        &mut self,
        slot: StableSlot,
    ) {
        self.0.remove(slot.value());
    }
}