rskit_fs/types.rs
1//! Shared filesystem metadata types.
2
3use std::ffi::OsString;
4use std::path::PathBuf;
5
6/// Metadata for an entry directly inside a directory.
7#[derive(Debug, Clone)]
8pub struct DirEntry {
9 /// Entry path.
10 pub path: PathBuf,
11 /// Entry file name.
12 pub file_name: OsString,
13 /// Whether the entry is a regular file.
14 pub is_file: bool,
15 /// Whether the entry is a directory.
16 pub is_dir: bool,
17 /// Whether the entry is a symlink.
18 pub is_symlink: bool,
19}
20
21/// Metadata for a filesystem entry at a file path.
22#[derive(Debug, Clone)]
23pub struct FileMeta {
24 /// File path.
25 pub path: PathBuf,
26 /// File size in bytes.
27 pub len: u64,
28 /// Creation time, when available.
29 pub created: Option<std::time::SystemTime>,
30 /// Last modification time, when available.
31 pub modified: Option<std::time::SystemTime>,
32 /// Whether this path is a regular file.
33 pub is_file: bool,
34 /// Whether this path is a directory.
35 pub is_dir: bool,
36 /// Whether this path is a symlink.
37 pub is_symlink: bool,
38}