OXYGENHUB
# c40c2d3edb51 oxygenhub / crates / hub / src / render / graph.rs
627 B · Rust · last changed State cache keyed by heads; history and graph through oxy-core's lanes and log window 1 month ago source blame history raw
1
//! The history graph's lane layout is `oxy_core::lanes`, shared with `oxy
2
//! log`; this module only adapts hex hashes from views to it.
3
4
pub use oxy_core::lanes::{width, Row};
5
6
/// `changes` newest first as `(hash hex, deps hex)`.
7
pub fn layout(changes: &[(String, Vec<String>)]) -> Vec<Row> {
8
    let parse = |h: &str| oxy_core::hash::ObjectRef::from_hex(h).unwrap_or(oxy_core::hash::ObjectRef([0; 32]));
9
    let input: Vec<(oxy_core::hash::ChangeHash, Vec<oxy_core::hash::ChangeHash>)> =
10
        changes.iter().map(|(h, d)| (parse(h), d.iter().map(|x| parse(x)).collect())).collect();
11
    oxy_core::lanes::layout(&input)
12
}