pub fn consume(&mut self, amount: usize) -> usize {
        let length = self.end - self.start;
        if amount < length {
            // move a pointer
            self.start += amount;
            amount
        } else if amount == length {
            self.start = 0;
            self.end = 0;
            self.await();
            amount
        } else {
            // refill the buffer
            self.skip_through(amount-length)
        }
    }
/// Advance the start of the buffer by N bytes
Advance the start of the buffer by N bytes
Advance the start of the buffer by N bytes
pub fn consume(&mut self, amount: usize) -> usize {
        let length = self.end - self.start;
        if amount < length {
            // move a pointer
            self.start += amount;
            amount
        } else if amount == length {
            self.start = 0;
            self.end = 0;
            self.await();
            amount
        } else {
            // refill the buffer
            self.skip_through(amount-length)
        }
    }
pub fn consume ( & mut self , amount : usize ) -> usize { let length = self . end - self . start ; if amount < length { // move a pointer self . start += amount ; amount } else if amount == length { self . start = 0 ; self . end = 0 ; self . await ( ) ; amount } else { // refill the buffer self . skip_through ( amount - length ) } }
Advance the start of the buffer by N bytes
Advance the start of the buffer by N bytes
&mut self
amount
usize
&mut self
amount
usize