mirror of
				https://github.com/isar/rusqlite.git
				synced 2025-10-31 13:58:55 +08:00 
			
		
		
		
	Backup progress callback can be Fn.
				
					
				
			This commit is contained in:
		| @@ -95,11 +95,11 @@ impl Connection { | |||||||
|     /// |     /// | ||||||
|     /// Will return `Err` if the destination path cannot be opened |     /// Will return `Err` if the destination path cannot be opened | ||||||
|     /// or if the restore fails. |     /// or if the restore fails. | ||||||
|     pub fn restore<P: AsRef<Path>>( |     pub fn restore<P: AsRef<Path>, F: Fn(Progress)>( | ||||||
|         &mut self, |         &mut self, | ||||||
|         name: DatabaseName, |         name: DatabaseName, | ||||||
|         src_path: P, |         src_path: P, | ||||||
|         progress: Option<fn(Progress)>, |         progress: Option<F>, | ||||||
|     ) -> Result<()> { |     ) -> Result<()> { | ||||||
|         use self::StepResult::{Busy, Done, Locked, More}; |         use self::StepResult::{Busy, Done, Locked, More}; | ||||||
|         let src = try!(Connection::open(src_path)); |         let src = try!(Connection::open(src_path)); | ||||||
| @@ -109,7 +109,7 @@ impl Connection { | |||||||
|         let mut busy_count = 0i32; |         let mut busy_count = 0i32; | ||||||
|         'restore_loop: while r == More || r == Busy { |         'restore_loop: while r == More || r == Busy { | ||||||
|             r = try!(restore.step(100)); |             r = try!(restore.step(100)); | ||||||
|             if let Some(f) = progress { |             if let Some(ref f) = progress { | ||||||
|                 f(restore.progress()); |                 f(restore.progress()); | ||||||
|             } |             } | ||||||
|             if r == Busy { |             if r == Busy { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user