From 9a34651063029394845a3e18fe7afd5b7c4db777 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 8 Sep 2024 22:30:05 +0200 Subject: folder last modified reflects newest child --- src/backup.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backup.rs') diff --git a/src/backup.rs b/src/backup.rs index a643cb2..675f020 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -20,7 +20,7 @@ pub type BackupId = String; #[derive(Debug, Serialize, Deserialize)] pub struct Backup { pub id: String, - timestamp: u64, + pub timestamp: u64, packages: Vec, pub files: Vec, device: String, @@ -74,16 +74,16 @@ impl Backup { Ok(Some(Self::from_index( config, - list.last().ok_or(Error::BackupNotFound)?.id.clone(), + &list.last().ok_or(Error::BackupNotFound)?.id, )?)) } - pub fn from_index(config: &Config, id: BackupId) -> Result { + pub fn from_index(config: &Config, id: &BackupId) -> Result { let backup_index_root = format!("{}/index.json", config.root); let list: Vec = Self::get_json_content(&backup_index_root)?; let index_loc = list .iter() - .find(|bl| bl.id == id) + .find(|bl| &bl.id == id) .ok_or(Error::BackupNotFound)? .rel_location .clone(); -- cgit v1.2.3