pub struct ShrinkOptions {
pub max_len: usize,
pub strategy: Strategy,
pub path_style: Option<PathStyle>,
pub ellipsis: String,
pub dir_length: usize,
pub full_length_dirs: usize,
pub mapped_locations: Vec<(String, String)>,
pub anchors: Vec<String>,
}Expand description
Configuration for path shortening.
Fields§
§max_len: usizeTarget maximum length. The output will be at most this long, unless the filename itself exceeds it (filenames are never truncated).
strategy: StrategyShortening strategy.
path_style: Option<PathStyle>Force a specific path style instead of auto-detecting.
ellipsis: StringCustom ellipsis string. Default: "...".
dir_length: usizeNumber of characters to keep per abbreviated directory segment. Default: 1.
full_length_dirs: usizeNumber of trailing directory segments to keep unabbreviated. Default: 0.
mapped_locations: Vec<(String, String)>Custom path prefix substitutions applied before shortening.
Each tuple is (from, to): if the path starts with from, replace it with to.
Sorted by longest match first at application time.
anchors: Vec<String>Segment names that should never be abbreviated, regardless of strategy.
Implementations§
Source§impl ShrinkOptions
impl ShrinkOptions
Sourcepub fn new(max_len: usize) -> Self
pub fn new(max_len: usize) -> Self
Create options with sensible defaults: Hybrid strategy, max_len as specified.
Sourcepub fn path_style(self, s: PathStyle) -> Self
pub fn path_style(self, s: PathStyle) -> Self
Force a specific path style.
Sourcepub fn dir_length(self, n: usize) -> Self
pub fn dir_length(self, n: usize) -> Self
Set the number of characters to keep per abbreviated directory segment.
Sourcepub fn full_length_dirs(self, n: usize) -> Self
pub fn full_length_dirs(self, n: usize) -> Self
Set the number of trailing directory segments to keep unabbreviated.
Trait Implementations§
Source§impl Clone for ShrinkOptions
impl Clone for ShrinkOptions
Source§fn clone(&self) -> ShrinkOptions
fn clone(&self) -> ShrinkOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more