trillium_static_compiled/
metadata.rs1use std::time::{Duration, SystemTime};
2
3#[derive(Debug, Copy, Clone, PartialEq, Eq)]
5pub struct Metadata {
6 accessed: Duration,
7 created: Duration,
8 modified: Duration,
9}
10
11impl Metadata {
12 pub const fn new(accessed: Duration, created: Duration, modified: Duration) -> Self {
15 Metadata {
16 accessed,
17 created,
18 modified,
19 }
20 }
21
22 pub const fn from_secs(accessed: u64, created: u64, modified: u64) -> Self {
24 Self::new(
25 Duration::from_secs(accessed),
26 Duration::from_secs(created),
27 Duration::from_secs(modified),
28 )
29 }
30
31 pub fn accessed(&self) -> SystemTime {
35 SystemTime::UNIX_EPOCH + self.accessed
36 }
37
38 pub fn created(&self) -> SystemTime {
42 SystemTime::UNIX_EPOCH + self.created
43 }
44
45 pub fn modified(&self) -> SystemTime {
49 SystemTime::UNIX_EPOCH + self.modified
50 }
51}