pub fn logical_ext(name: &OsStr) -> Option<String>Expand description
Return the logical extension of a file name, lowercased and including its leading dot.
The logical level is name-owned rather than registry-owned. It retains at most two trailing dotted components when each is nonempty, ASCII alphanumeric, and at most twelve characters. A leading dot belongs to the basename, and an ineligible final component means the name has no logical extension.
This is the value a portable entry row reports, and the one declared extensions are
matched against (TypeRegistry::canonical_ext). The extension view’s aggregate
buckets and an unrecognized type’s label use the raw derive_ext instead.
use std::ffi::OsStr;
use fdu_core::classify::logical_ext;
assert_eq!(logical_ext(OsStr::new("archive.tar.gz")).as_deref(), Some(".tar.gz"));
assert_eq!(logical_ext(OsStr::new("release.v2.zip")).as_deref(), Some(".v2.zip"));
assert_eq!(logical_ext(OsStr::new(".gitignore")), None);