diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-02-26 07:18:46 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-03-03 18:54:32 +0200 |
commit | 83b83530c05e23945cfe5a11a2125c4d93d40a93 (patch) | |
tree | 59f2c38cd3e0214c3aea9b8f0b569193925dec25 /src/cmd/restore.rs | |
parent | dd8ac8901cd15945bce8d1a072abbcbdfe6d5a83 (diff) | |
download | obnam2-83b83530c05e23945cfe5a11a2125c4d93d40a93.tar.gz |
refactor: use FileId instead of raw type
This is clearer and less error prone.
Sponsored-by: author
Diffstat (limited to 'src/cmd/restore.rs')
-rw-r--r-- | src/cmd/restore.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs index 7b3d95e..983efbb 100644 --- a/src/cmd/restore.rs +++ b/src/cmd/restore.rs @@ -3,6 +3,7 @@ use crate::backup_reason::Reason; use crate::client::{BackupClient, ClientError}; use crate::config::ClientConfig; +use crate::dbgen::FileId; use crate::error::ObnamError; use crate::fsentry::{FilesystemEntry, FilesystemKind}; use crate::generation::{LocalGeneration, LocalGenerationError}; @@ -132,7 +133,7 @@ pub enum RestoreError { async fn restore_generation( client: &BackupClient, gen: &LocalGeneration, - fileid: i64, + fileid: FileId, entry: &FilesystemEntry, to: &Path, progress: &ProgressBar, @@ -185,7 +186,7 @@ async fn restore_regular( client: &BackupClient, gen: &LocalGeneration, path: &Path, - fileid: i64, + fileid: FileId, entry: &FilesystemEntry, ) -> Result<(), RestoreError> { debug!("restoring regular {}", path.display()); @@ -293,9 +294,9 @@ fn path_to_cstring(path: &Path) -> CString { CString::new(path).unwrap() } -fn create_progress_bar(file_count: i64, verbose: bool) -> ProgressBar { +fn create_progress_bar(file_count: FileId, verbose: bool) -> ProgressBar { let progress = if verbose { - ProgressBar::new(file_count as u64) + ProgressBar::new(file_count) } else { ProgressBar::hidden() }; |