pub fn done(&self, err: Result<(), &str>) -> () {
    for cb in self.callbacks.lock().unwrap().iter() {
      cb(err)
    }
    self.running.store(false, Ordering::Relaxed);
    let mut pending_callbacks = self.pending_callbacks.lock().unwrap();
    let mut pending_batch = self.pending_batch.lock().unwrap();
    *self.callbacks.lock().unwrap() = pending_callbacks.drain(..).collect();
    let nextbatch: Vec<T> = pending_batch.drain(..).collect();
    if nextbatch.is_empty() && self.callbacks.lock().unwrap().is_empty() {
      return;
    }
    self.running.store(true, Ordering::Relaxed);
    (self.run)(nextbatch, self);
  }
/// Turn batcher's running state to off. then call the run function.
Turn batcher's running state to off. then call the run function.
Turn batcher ' s running state to off . then call the run function .
pub fn done(&self, err: Result<(), &str>) -> () {
    for cb in self.callbacks.lock().unwrap().iter() {
      cb(err)
    }
    self.running.store(false, Ordering::Relaxed);
    let mut pending_callbacks = self.pending_callbacks.lock().unwrap();
    let mut pending_batch = self.pending_batch.lock().unwrap();
    *self.callbacks.lock().unwrap() = pending_callbacks.drain(..).collect();
    let nextbatch: Vec<T> = pending_batch.drain(..).collect();
    if nextbatch.is_empty() && self.callbacks.lock().unwrap().is_empty() {
      return;
    }
    self.running.store(true, Ordering::Relaxed);
    (self.run)(nextbatch, self);
  }
pub fn done ( & self , err : Result < ( ) , & str > ) -> ( ) { for cb in self . callbacks . lock ( ) . unwrap ( ) . iter ( ) { cb ( err ) } self . running . store ( false , Ordering :: Relaxed ) ; let mut pending_callbacks = self . pending_callbacks . lock ( ) . unwrap ( ) ; let mut pending_batch = self . pending_batch . lock ( ) . unwrap ( ) ; * self . callbacks . lock ( ) . unwrap ( ) = pending_callbacks . drain ( .. ) . collect ( ) ; let nextbatch : Vec < T > = pending_batch . drain ( .. ) . collect ( ) ; if nextbatch . is_empty ( ) && self . callbacks . lock ( ) . unwrap ( ) . is_empty ( ) { return ; } self . running . store ( true , Ordering :: Relaxed ) ; ( self . run ) ( nextbatch , self ) ; }
Turn batcher's running state to off.
Turn batcher ' s running state to off .
&self
err
Result<(), &str>