pub fn append(&self, val: Vec<T>, cb: CbOption) -> () {
    if self.running.load(Ordering::Relaxed) {
      if self.pending_batch.lock().unwrap().len() == 0 {
        *self.pending_callbacks.lock().unwrap() = Vec::new();
      }
      self.pending_batch.lock().unwrap().extend(val);
      if let Some(cb) = cb {
        self.callbacks.lock().unwrap().push(cb);
      }
    } else {
      if let Some(cb) = cb {
        *self.callbacks.lock().unwrap() = vec![cb];
      }
      self.running.store(true, Ordering::Relaxed);
      (self.run)(val, self);
    }
  }
/// Accept an array of values and a callback.
/// The accepted callback is called when the batch containing the values have been run.
Accept an array of values and a callback.
The accepted callback is called when the batch containing the values have been run.
Accept an array of values and a callback . The accepted callback is called when the batch containing the values have been run .
pub fn append(&self, val: Vec<T>, cb: CbOption) -> () {
    if self.running.load(Ordering::Relaxed) {
      if self.pending_batch.lock().unwrap().len() == 0 {
        *self.pending_callbacks.lock().unwrap() = Vec::new();
      }
      self.pending_batch.lock().unwrap().extend(val);
      if let Some(cb) = cb {
        self.callbacks.lock().unwrap().push(cb);
      }
    } else {
      if let Some(cb) = cb {
        *self.callbacks.lock().unwrap() = vec![cb];
      }
      self.running.store(true, Ordering::Relaxed);
      (self.run)(val, self);
    }
  }
pub fn append ( & self , val : Vec < T > , cb : CbOption ) -> ( ) { if self . running . load ( Ordering :: Relaxed ) { if self . pending_batch . lock ( ) . unwrap ( ) . len ( ) == 0 { * self . pending_callbacks . lock ( ) . unwrap ( ) = Vec :: new ( ) ; } self . pending_batch . lock ( ) . unwrap ( ) . extend ( val ) ; if let Some ( cb ) = cb { self . callbacks . lock ( ) . unwrap ( ) . push ( cb ) ; } } else { if let Some ( cb ) = cb { * self . callbacks . lock ( ) . unwrap ( ) = vec ! [ cb ] ; } self . running . store ( true , Ordering :: Relaxed ) ; ( self . run ) ( val , self ) ; } }
Accept an array of values and a callback.
Accept an array of values and a callback .
&self
val
Vec<T>
cb
CbOption