pub fn shorten_path(path: &str, length: usize) -> Cow<'_, str>
Expand description
Trims a path to a given length.
This attempts to not completely destroy the path in the process by trimming off the middle path segments. In the process, this tries to determine whether the path is a Windows or Unix path and handle directory separators accordingly.
ยงExamples
assert_eq!(
symbolic_common::shorten_path("/foo/bar/baz/blah/blafasel", 21),
"/foo/.../blafasel"
);