summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Batischev <eual.jp@gmail.com>2021-07-21 21:17:27 +0300
committerAlexander Batischev <eual.jp@gmail.com>2021-07-21 21:17:27 +0300
commit90e8f2dbf2f87a6a8fef8d44801642d9c644050f (patch)
tree3eb180f562657ea5e09550fb358f6ec75a2bc81a
parentdf5d50b2c2fe705de059d9ea983ce21ca49ed132 (diff)
downloadobnam2-90e8f2dbf2f87a6a8fef8d44801642d9c644050f.tar.gz
Replace BackupResult with plain Result
-rw-r--r--src/backup_run.rs11
-rw-r--r--src/generation.rs4
2 files changed, 8 insertions, 7 deletions
diff --git a/src/backup_run.rs b/src/backup_run.rs
index 622485d..ccbf640 100644
--- a/src/backup_run.rs
+++ b/src/backup_run.rs
@@ -30,10 +30,8 @@ pub enum BackupError {
LocalGenerationError(#[from] LocalGenerationError),
}
-pub type BackupResult<T> = Result<T, BackupError>;
-
impl<'a> BackupRun<'a> {
- pub fn initial(config: &ClientConfig, client: &'a BackupClient) -> BackupResult<Self> {
+ pub fn initial(config: &ClientConfig, client: &'a BackupClient) -> Result<Self, BackupError> {
Ok(Self {
client,
policy: BackupPolicy::default(),
@@ -42,7 +40,10 @@ impl<'a> BackupRun<'a> {
})
}
- pub fn incremental(config: &ClientConfig, client: &'a BackupClient) -> BackupResult<Self> {
+ pub fn incremental(
+ config: &ClientConfig,
+ client: &'a BackupClient,
+ ) -> Result<Self, BackupError> {
Ok(Self {
client,
policy: BackupPolicy::default(),
@@ -111,7 +112,7 @@ impl<'a> BackupRun<'a> {
&self,
entry: FsIterResult<FilesystemEntry>,
old: &LocalGeneration,
- ) -> BackupResult<(FilesystemEntry, Vec<ChunkId>, Reason)> {
+ ) -> Result<(FilesystemEntry, Vec<ChunkId>, Reason), BackupError> {
match entry {
Err(err) => {
warn!("backup: {}", err);
diff --git a/src/generation.rs b/src/generation.rs
index e48dce2..f4e4f53 100644
--- a/src/generation.rs
+++ b/src/generation.rs
@@ -1,5 +1,5 @@
use crate::backup_reason::Reason;
-use crate::backup_run::{BackupError, BackupResult};
+use crate::backup_run::BackupError;
use crate::chunkid::ChunkId;
use crate::fsentry::FilesystemEntry;
use log::debug;
@@ -67,7 +67,7 @@ impl NascentGeneration {
pub fn insert_iter(
&mut self,
- entries: impl Iterator<Item = BackupResult<(FilesystemEntry, Vec<ChunkId>, Reason)>>,
+ entries: impl Iterator<Item = Result<(FilesystemEntry, Vec<ChunkId>, Reason), BackupError>>,
) -> NascentResult<Vec<BackupError>> {
let t = self.conn.transaction().map_err(NascentError::Transaction)?;
let mut warnings = vec![];