gctree 0.35.0

A library for cache-friendly, graph-like, arena-allocated datastructures.
Documentation
//!

use crate::new::node_idx::NodeIdx;

pub type ArenaResult<T, I> = std::result::Result<T, ArenaError<I>>;

#[derive(Debug)]
// #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
// #[derive(serde::Deserialize, serde::Serialize)]
#[derive(displaydoc::Display, thiserror::Error)]
pub enum ArenaError<I>
where
    I: NodeIdx,
{
    /// Expected {node_idx} to have parent {parent_idx}
    ParentOrdinalNotFound { node_idx: I, parent_idx: I },
    /// Expected {node_idx} to have child {child_idx}
    ChildOrdinalNotFound { node_idx: I, child_idx: I },
    /// Parent edge {child} -> {parent} does not exist
    ParentEdgeDoesNotExist { parent: I, child: I },
    /// Child edge {parent} -> {child} does not exist
    ChildEdgeDoesNotExist { parent: I, child: I },
    /// Illegal node index: {0}
    InvalidNodeIdx(I),
}