mirror of
https://github.com/OMGeeky/gdriver2.git
synced 2025-12-30 08:23:28 +01:00
29 lines
652 B
Rust
29 lines
652 B
Rust
use std::collections::HashMap;
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
use crate::prelude::*;
|
|
|
|
pub struct Drive {
|
|
tracked_files: HashMap<DriveId, DateTime<Utc>>,
|
|
}
|
|
impl Drive {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
tracked_files: HashMap::new(),
|
|
}
|
|
}
|
|
pub fn get_file_tracking_state(&self, id: &DriveId) -> TrackingState {
|
|
let file = self.tracked_files.get(id);
|
|
match file {
|
|
Some(date) => TrackingState::Tracked(*date),
|
|
None => TrackingState::Untracked,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub enum TrackingState {
|
|
Untracked,
|
|
Tracked(DateTime<Utc>),
|
|
}
|