pub fn dir_name(input: &str) -> Option<String>
Extracts the most relevant directory segment from a path-like input.