pub fn parse_path_filename(path: &Path) -> Option<(String, String)>
Expand description
Parses the filename of a Dylint library path into a tuple of (name, toolchain).
ยงExamples
use dylint_internal::parse_path_filename;
use std::path::Path;
#[cfg(target_os = "linux")]
assert_eq!(
parse_path_filename(Path::new("libfoo@stable-x86_64-unknown-linux-gnu.so")),
Some((
String::from("foo"),
String::from("stable-x86_64-unknown-linux-gnu")
))
);
#[cfg(target_os = "macos")]
assert_eq!(
parse_path_filename(Path::new("libfoo@stable-x86_64-apple-darwin.dylib")),
Some((
String::from("foo"),
String::from("stable-x86_64-apple-darwin")
))
);
#[cfg(target_os = "windows")]
assert_eq!(
parse_path_filename(Path::new("foo@stable-x86_64-pc-windows-msvc.dll")),
Some((
String::from("foo"),
String::from("stable-x86_64-pc-windows-msvc")
))
);