Skip to main content

base_scheduler/
file_metadata.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::FileType;
5use std::time::SystemTime;
6
7/// Portable accessors for owned file status returned by [`crate::FileStat::file_stat`]. Each backend chooses its representation, so native results need no eager field conversion and simulations need no OS resources.
8///
9/// `None` means a field was not supplied or cannot be represented. Fields can reflect different instants during concurrent modification; metadata is an observation, not an atomic snapshot or synchronization operation. Native fields remain available through the concrete result type.
10pub trait FileMetadata: Send + Sync + 'static {
11    /// The kind of filesystem object.
12    fn file_type(&self) -> Option<FileType>;
13
14    /// Logical length in bytes for regular files. Other file types follow the platform's meaning; this is not allocated disk space.
15    fn size(&self) -> Option<u64>;
16
17    /// Last access time. Filesystem policies can suppress or defer updates.
18    fn accessed(&self) -> Option<SystemTime>;
19
20    /// Last content modification time.
21    fn modified(&self) -> Option<SystemTime>;
22
23    /// Creation time. Never substituted with Unix status-change time.
24    fn created(&self) -> Option<SystemTime>;
25}