diff --git a/src/bin/pxar.rs b/src/bin/pxar.rs index 4d2308bf..3d92dbe0 100644 --- a/src/bin/pxar.rs +++ b/src/bin/pxar.rs @@ -17,7 +17,7 @@ use proxmox::api::cli::*; use proxmox::api::api; use proxmox_backup::tools; -use proxmox_backup::pxar::{fuse, format_single_line_entry, ENCODER_MAX_ENTRIES, Flags}; +use proxmox_backup::pxar::{fuse, format_single_line_entry, ENCODER_MAX_ENTRIES, ErrorHandler, Flags}; fn extract_archive_from_reader( reader: &mut R, @@ -27,7 +27,7 @@ fn extract_archive_from_reader( verbose: bool, match_list: &[MatchEntry], extract_match_default: bool, - on_error: Option Result<(), Error> + Send>>, + on_error: Option, ) -> Result<(), Error> { proxmox_backup::pxar::extract_archive( pxar::decoder::Decoder::from_std(reader)?, diff --git a/src/pxar/extract.rs b/src/pxar/extract.rs index 12f9054d..e22fc847 100644 --- a/src/pxar/extract.rs +++ b/src/pxar/extract.rs @@ -24,6 +24,8 @@ use crate::pxar::dir_stack::PxarDirStack; use crate::pxar::metadata; use crate::pxar::Flags; +pub type ErrorHandler = Box Result<(), Error> + Send>; + pub fn extract_archive( mut decoder: pxar::decoder::Decoder, destination: &Path, @@ -32,7 +34,7 @@ pub fn extract_archive( feature_flags: Flags, allow_existing_dirs: bool, mut callback: F, - on_error: Option Result<(), Error> + Send>>, + on_error: Option, ) -> Result<(), Error> where T: pxar::decoder::SeqRead, @@ -212,7 +214,7 @@ pub(crate) struct Extractor { /// Error callback. Includes `current_path` in the reformatted error, should return `Ok` to /// continue extracting or the passed error as `Err` to bail out. - on_error: Box Result<(), Error> + Send>, + on_error: ErrorHandler, } impl Extractor { diff --git a/src/pxar/mod.rs b/src/pxar/mod.rs index 6e910667..82998cf8 100644 --- a/src/pxar/mod.rs +++ b/src/pxar/mod.rs @@ -59,7 +59,7 @@ mod flags; pub use flags::Flags; pub use create::create_archive; -pub use extract::extract_archive; +pub use extract::{extract_archive, ErrorHandler}; /// The format requires to build sorted directory lookup tables in /// memory, so we restrict the number of allowed entries to limit