From 16f8c980a648e23ac1d8e1127f7ac7262cc91d9d Mon Sep 17 00:00:00 2001 From: RumovZ Date: Sun, 17 Apr 2022 09:35:56 +0200 Subject: [PATCH] Fix progress_fn type --- rslib/src/import_export/package/apkg/import/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rslib/src/import_export/package/apkg/import/mod.rs b/rslib/src/import_export/package/apkg/import/mod.rs index bec8598a4..c718f48f6 100644 --- a/rslib/src/import_export/package/apkg/import/mod.rs +++ b/rslib/src/import_export/package/apkg/import/mod.rs @@ -20,19 +20,21 @@ use crate::{ search::SearchNode, }; +type ProgressFn = dyn FnMut(ImportProgress) -> Result<()>; + struct Context<'a> { target_col: &'a mut Collection, archive: ZipArchive, data: ExchangeData, usn: Usn, - progress_fn: &'a mut dyn Fn(ImportProgress) -> Result<()>, + progress_fn: &'a mut ProgressFn, } impl Collection { pub fn import_apkg( &mut self, path: impl AsRef, - progress_fn: &mut dyn Fn(ImportProgress) -> Result<()>, + progress_fn: &mut ProgressFn, ) -> Result> { let file = File::open(path)?; let archive = ZipArchive::new(file)?; @@ -48,7 +50,7 @@ impl<'a> Context<'a> { fn new( mut archive: ZipArchive, target_col: &'a mut Collection, - progress_fn: &'a mut dyn Fn(ImportProgress) -> Result<()>, + progress_fn: &'a mut ProgressFn, ) -> Result { let data = ExchangeData::gather_from_archive(&mut archive, SearchNode::WholeCollection, true)?;