#[derive(Clone, Copy, Debug)]
pub struct GlyphSet {
pub tee: &'static str,
pub last: &'static str,
pub pipe: &'static str,
pub space: &'static str,
}
pub const UTF: GlyphSet = GlyphSet {
tee: "├── ",
last: "└── ",
pipe: "│ ",
space: " ",
};
pub const ASCII: GlyphSet = GlyphSet {
tee: "+-- ",
last: "\\-- ",
pipe: "| ",
space: " ",
};
pub fn indent_prefix(ancestors_more: &[bool], g: &GlyphSet) -> String {
let mut s = String::new();
for &more in ancestors_more {
if more {
s.push_str(g.pipe);
} else {
s.push_str(g.space);
}
}
s
}
pub fn head(is_last: bool, g: &GlyphSet) -> &'static str {
if is_last { g.last } else { g.tee }
}