OXYGENHUB
# de505df5cf8d 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
9ff27da5 Andy McCall ↶ 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.
d23464c0 Andy McCall ↶ 3
9ff27da5 Andy McCall ↶ 4
pub use oxy_core::lanes::{width, Row};
d23464c0 Andy McCall ↶ 5
9ff27da5 Andy McCall ↶ 6
/// `changes` newest first as `(hash hex, deps hex)`.
d23464c0 Andy McCall ↶ 7
pub fn layout(changes: &[(String, Vec<String>)]) -> Vec<Row> {
9ff27da5 Andy McCall ↶ 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)
d23464c0 Andy McCall ↶ 12
}