pub fn drain(&mut self, num: Option<usize>) -> Vec<BatchPair> {
        let batches = match num {
            Some(num) => {
                let batches = self.batches.drain(..num).collect::<Vec<_>>();
                for batch in &batches {
                    self.ids.remove(batch.batch().header_signature());
                }
                batches
            }
            None => {
                self.ids.clear();
                self.batches.drain(..).collect()
            }
        };
        gauge!(PENDING_BATCH_GAUGE, self.batches.len() as i64);
        batches
    }
/// Takes the given number of batches from the front of the queue
///
/// If no number is specified, all batches in the queue will be returned.
///
/// This method may return fewer than the requested number of batches if the queue is smaller
/// than the requested number
Takes the given number of batches from the front of the queue
If no number is specified, all batches in the queue will be returned.

This method may return fewer than the requested number of batches if the queue is smaller
than the requested number
Takes the given number of batches from the front of the queue If no number is specified all batches in the queue will be returned . This method may return fewer than the requested number of batches if the queue is smaller than the requested number
pub fn drain(&mut self, num: Option<usize>) -> Vec<BatchPair> {
        let batches = match num {
            Some(num) => {
                let batches = self.batches.drain(..num).collect::<Vec<_>>();
                for batch in &batches {
                    self.ids.remove(batch.batch().header_signature());
                }
                batches
            }
            None => {
                self.ids.clear();
                self.batches.drain(..).collect()
            }
        };
        gauge!(PENDING_BATCH_GAUGE, self.batches.len() as i64);
        batches
    }
pub fn drain ( & mut self , num : Option < usize > ) -> Vec < BatchPair > { let batches = match num { Some ( num ) => { let batches = self . batches . drain ( .. num ) . collect :: < Vec < _ > > ( ) ; for batch in & batches { self . ids . remove ( batch . batch ( ) . header_signature ( ) ) ; } batches } None => { self . ids . clear ( ) ; self . batches . drain ( .. ) . collect ( ) } } ; gauge ! ( PENDING_BATCH_GAUGE self batches len ( ) as i64 ) ; batches }
Takes the given number of batches from the front of the queue
If no number is specified, all batches in the queue will be returned.
Takes the given number of batches from the front of the queue If no number is specified all batches in the queue will be returned .
&mut self
num
Option<usize>
&mut self
num
Option<usize>