libpitust 0.1.0

libpitust implements random utility functions I tend to use a lot
Documentation
pub mod dag_sched;
pub mod domtree;
pub mod indexgraph;
pub mod inverted;
pub mod mapgraph;
pub mod node_map;
pub mod postorder;
pub mod preorder;
pub mod scc;

pub trait GraphBase: Copy {
    type Node: Copy + Eq;
    type NodeMapImpl<Value>: NodeMapImpl<Self::Node, Value = Value>;

    fn clear_nodemap<Value>(
        self,
        map: &mut Self::NodeMapImpl<Value>,
        init: impl FnMut(Self::Node) -> Value,
    );

    fn nodes(self) -> impl Iterator<Item = Self::Node>;
}
pub trait NodeMapImpl<Node: Copy>: Sized + Default {
    type Value;

    fn nodemap_get(&self, node: Node) -> &Self::Value;
    fn nodemap_get_mut(&mut self, node: Node) -> &mut Self::Value;
}

pub trait GraphSucc: GraphBase {
    fn succ_of(self, node: Self::Node) -> impl Iterator<Item = Self::Node>;
}
pub trait GraphPred: GraphBase {
    fn pred_of(self, node: Self::Node) -> impl Iterator<Item = Self::Node>;
}
pub trait GraphRooted: GraphBase {
    type RootInfo: Copy;

    fn root_node(self) -> Self::Node {
        Self::root_node_from_info(self.root_node_info())
    }

    fn root_node_from_info(info: Self::RootInfo) -> Self::Node;
    fn root_node_info(self) -> Self::RootInfo;
}