mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
Fix progress_fn type
This commit is contained in:
parent
e65b79ba63
commit
16f8c980a6
1 changed files with 5 additions and 3 deletions
|
@ -20,19 +20,21 @@ use crate::{
|
||||||
search::SearchNode,
|
search::SearchNode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ProgressFn = dyn FnMut(ImportProgress) -> Result<()>;
|
||||||
|
|
||||||
struct Context<'a> {
|
struct Context<'a> {
|
||||||
target_col: &'a mut Collection,
|
target_col: &'a mut Collection,
|
||||||
archive: ZipArchive<File>,
|
archive: ZipArchive<File>,
|
||||||
data: ExchangeData,
|
data: ExchangeData,
|
||||||
usn: Usn,
|
usn: Usn,
|
||||||
progress_fn: &'a mut dyn Fn(ImportProgress) -> Result<()>,
|
progress_fn: &'a mut ProgressFn,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub fn import_apkg(
|
pub fn import_apkg(
|
||||||
&mut self,
|
&mut self,
|
||||||
path: impl AsRef<Path>,
|
path: impl AsRef<Path>,
|
||||||
progress_fn: &mut dyn Fn(ImportProgress) -> Result<()>,
|
progress_fn: &mut ProgressFn,
|
||||||
) -> Result<OpOutput<()>> {
|
) -> Result<OpOutput<()>> {
|
||||||
let file = File::open(path)?;
|
let file = File::open(path)?;
|
||||||
let archive = ZipArchive::new(file)?;
|
let archive = ZipArchive::new(file)?;
|
||||||
|
@ -48,7 +50,7 @@ impl<'a> Context<'a> {
|
||||||
fn new(
|
fn new(
|
||||||
mut archive: ZipArchive<File>,
|
mut archive: ZipArchive<File>,
|
||||||
target_col: &'a mut Collection,
|
target_col: &'a mut Collection,
|
||||||
progress_fn: &'a mut dyn Fn(ImportProgress) -> Result<()>,
|
progress_fn: &'a mut ProgressFn,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let data =
|
let data =
|
||||||
ExchangeData::gather_from_archive(&mut archive, SearchNode::WholeCollection, true)?;
|
ExchangeData::gather_from_archive(&mut archive, SearchNode::WholeCollection, true)?;
|
||||||
|
|
Loading…
Reference in a new issue