pipecircuit 0.0.15

Correct. Robust. Fast. Portable.
Documentation
use alloc::vec::Vec;

mod creation;
mod inconsistency;
mod insert;
mod lookup;
mod remove;

pub use creation::StableSlotsCreationError;
pub use inconsistency::StableSlotsInconsistency;
pub use insert::{PreparedStableSlotInsert, StableSlotInsertError};
pub use lookup::{StableSlotResolutions, StableSlotResolveOutcome, StableSlotResolver};
pub use remove::{PreparedStableSlotRemove, StableSlotRemoveOutcome, StableSlotRowRelocation};

crate::value_wrapper! {
    #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
    pub struct StableSlot(u32);
}

enum SlotLocation {
    Occupied(u32),
    Free(Option<StableSlot>),
}

pub struct StableSlots {
    maximum_rows: usize,
    row_to_slot: Vec<StableSlot>,
    slot_locations: Vec<SlotLocation>,
    first_free: Option<StableSlot>,
}

#[cfg(test)]
mod tests;