Backup progress callback can be Fn.

This commit is contained in:
gwenn 2018-08-15 18:00:58 +02:00
parent e7d128c842
commit ec53f19be1

View File

@ -95,11 +95,11 @@ impl Connection {
///
/// Will return `Err` if the destination path cannot be opened
/// or if the restore fails.
pub fn restore<P: AsRef<Path>>(
pub fn restore<P: AsRef<Path>, F: Fn(Progress)>(
&mut self,
name: DatabaseName,
src_path: P,
progress: Option<fn(Progress)>,
progress: Option<F>,
) -> Result<()> {
use self::StepResult::{Busy, Done, Locked, More};
let src = try!(Connection::open(src_path));
@ -109,7 +109,7 @@ impl Connection {
let mut busy_count = 0i32;
'restore_loop: while r == More || r == Busy {
r = try!(restore.step(100));
if let Some(f) = progress {
if let Some(ref f) = progress {
f(restore.progress());
}
if r == Busy {