pub fn stacks(
out: impl Write,
err: Option<impl Write>,
walk_options: WalkOptions,
paths: Vec<PathBuf>,
max_depth: Option<usize>,
) -> Result<WalkResult>Expand description
Traverse paths and write the tree to out as folded stacks, one entry per line, ready
to pipe into flame-graph tools like inferno.
Each line is an entry’s path from the traversal root, with its components separated by ;,
followed by a single space and the entry’s own size in bytes. A directory contributes only the
size of its own directory entry, as the sizes of everything it contains appear on the lines of
the contained entries.
Without max_depth, each entry’s own size is known when it is traversed, so its line can be
written immediately without retaining the complete tree. With max_depth, sizes below the
limit must be folded into their nearest visible ancestor. Because an ancestor is visited before
its descendants, its final size is unknown until traversal finishes; the requested levels are
therefore retained and written afterward instead of streamed.