cycle_ptr 0.1.1

Smart pointers, with cycles
Documentation
//! Colours used during the mark-sweep algorithm.

/// The colour states used during the mark-sweep algorithm.
#[derive(Debug, PartialEq, Eq)]
pub(crate) enum Colour {
    /// White objects are either unreachable, or only reachable from a [Colour::Grey] object.
    White,
    /// Grey objects are reachable, but some objects reachable from the grey objects might be marked [Colour::White].
    Grey,
    /// Black objects are reachable, and there are no [Colour::White] objects directly reachable from this object.
    Black,
}

/// The colours used when resetting colours at the start of a mark-sweep loop.
#[derive(Debug, PartialEq, Eq)]
pub(super) enum GCInitialColour {
    /// White objects don't have strong references pointing at them.
    ///
    /// Corresponds to [Colour::White].
    White,
    /// Grey objects have at least one strong reference pointing at them.
    ///
    /// Corresponds to [Colour::Grey].
    Grey,
}