pub fn outline(lang: Lang, text: &str) -> Vec<Entry>Expand description
Outline text with the lang rule pack, in source order.
ยงExamples
use coding_tools::outline::{outline, Lang};
let src = "pub struct Point { x: i32 }\n\nimpl Point {\n fn norm(&self) -> i32 { 0 }\n}\n";
let entries = outline(Lang::Rust, src);
let rows: Vec<String> = entries
.iter()
.map(|e| format!("{}:{} {} {} d{}", e.start, e.end.map_or("?".into(), |n| n.to_string()), e.kind, e.name, e.depth))
.collect();
assert_eq!(rows, [
"1:1 struct Point d1",
"3:5 impl Point d1",
"4:4 fn norm d2",
]);