/*
	returns reference to first half of the buffer
	up to the size of `amount`,
	which is going to be discarded
	after lifetime of returned slice comes to an end
	*/
returns reference to first half of the buffer
up to the size of `amount`,
which is going to be discarded
after lifetime of returned slice comes to an end
returns reference to first half of the buffer up to the size of ` amount ` which is going to be discarded after lifetime of returned slice comes to an end
fn consume(&mut self, amount: usize) -> &[u8] {
		let start = self.start;
		let amount = std::cmp::min(amount, self.len());
		self.start += amount;
		if self.start >= self.bufsize {
			// keep self.start within bufsize
			self.start -= self.bufsize;
		}
		self.len -= amount;
		&(unsafe {
			self.buf.as_mut_slice()
		})[ start .. (start+amount) ]
	}
fn consume ( & mut self , amount : usize ) -> & [ u8 ] { let start = self . start ; let amount = std :: cmp :: min ( amount , self . len ( ) ) ; self . start += amount ; if self . start >= self . bufsize { // keep self.start within bufsize self . start -= self . bufsize ; } self . len -= amount ; & ( unsafe { self . buf . as_mut_slice ( ) } ) [ start .. ( start + amount ) ] }
returns reference to first half of the buffer
up to the size of `amount`,
which is going to be discarded
after lifetime of returned slice comes to an end
returns reference to first half of the buffer up to the size of ` amount ` which is going to be discarded after lifetime of returned slice comes to an end
&mut self
amount
usize