/rust/registry/src/index.crates.io-1949cf8c6b5b557f/walkdir-2.5.0/src/util.rs
Line | Count | Source |
1 | | use std::io; |
2 | | use std::path::Path; |
3 | | |
4 | | #[cfg(unix)] |
5 | 0 | pub fn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> { |
6 | | use std::os::unix::fs::MetadataExt; |
7 | | |
8 | 0 | path.as_ref().metadata().map(|md| md.dev()) Unexecuted instantiation: walkdir::util::device_num::<&std::path::Path>::{closure#0}Unexecuted instantiation: walkdir::util::device_num::<&std::path::PathBuf>::{closure#0} |
9 | 0 | } Unexecuted instantiation: walkdir::util::device_num::<&std::path::Path> Unexecuted instantiation: walkdir::util::device_num::<&std::path::PathBuf> |
10 | | |
11 | | #[cfg(windows)] |
12 | | pub fn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> { |
13 | | use winapi_util::{file, Handle}; |
14 | | |
15 | | let h = Handle::from_path_any(path)?; |
16 | | file::information(h).map(|info| info.volume_serial_number()) |
17 | | } |
18 | | |
19 | | #[cfg(not(any(unix, windows)))] |
20 | | pub fn device_num<P: AsRef<Path>>(_: P) -> io::Result<u64> { |
21 | | Err(io::Error::new( |
22 | | io::ErrorKind::Other, |
23 | | "walkdir: same_file_system option not supported on this platform", |
24 | | )) |
25 | | } |