pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
		F: FnOnce(&mut ClientImportOperation<Block, Blake2Hasher, B>) -> Result<R, Err>,
		Err: From<error::Error>,
	{
		let inner = || {
			let _import_lock = self.import_lock.lock();

			let mut op = ClientImportOperation {
				op: self.backend.begin_operation()?,
				notify_imported: None,
				notify_finalized: Vec::new(),
			};

			let r = f(&mut op)?;

			let ClientImportOperation { op, notify_imported, notify_finalized } = op;
			self.backend.commit_operation(op)?;
			self.notify_finalized(notify_finalized)?;

			if let Some(notify_imported) = notify_imported {
				self.notify_imported(notify_imported)?;
			}

			Ok(r)
		};

		let result = inner();
		*self.importing_block.write() = None;

		result
	}
/// Lock the import lock, and run operations inside.
Lock the import lock, and run operations inside.
Lock the import lock and run operations inside .
pub fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err> where
		F: FnOnce(&mut ClientImportOperation<Block, Blake2Hasher, B>) -> Result<R, Err>,
		Err: From<error::Error>,
	{
		let inner = || {
			let _import_lock = self.import_lock.lock();
			let mut op = ClientImportOperation {
				op: self.backend.begin_operation()?,
				notify_imported: None,
				notify_finalized: Vec::new(),
			};
			let r = f(&mut op)?;
			let ClientImportOperation { op, notify_imported, notify_finalized } = op;
			self.backend.commit_operation(op)?;
			self.notify_finalized(notify_finalized)?;
			if let Some(notify_imported) = notify_imported {
				self.notify_imported(notify_imported)?;
			}
			Ok(r)
		};
		let result = inner();
		*self.importing_block.write() = None;
		result
	}
pub fn lock_import_and_run < R , Err , F > ( & self , f : F ) -> Result < R , Err > where F : FnOnce ( & mut ClientImportOperation < Block , Blake2Hasher , B > ) -> Result < R , Err > , Err : From < error :: Error > , { let inner = | | { let _import_lock = self . import_lock . lock ( ) ; let mut op = ClientImportOperation { op : self . backend . begin_operation ( ) ? , notify_imported : None , notify_finalized : Vec :: new ( ) , } ; let r = f ( & mut op ) ? ; let ClientImportOperation { op , notify_imported , notify_finalized } = op ; self . backend . commit_operation ( op ) ? ; self . notify_finalized ( notify_finalized ) ? ; if let Some ( notify_imported ) = notify_imported { self . notify_imported ( notify_imported ) ? ; } Ok ( r ) } ; let result = inner ( ) ; * self . importing_block . write ( ) = None ; result }
Lock the import lock, and run operations inside.
Lock the import lock and run operations inside .
&self
f
F
&self
f
F