Clear all existing data from this buffer.
(&mut self)
| 500 | |
| 501 | /// Clear all existing data from this buffer. |
| 502 | pub fn clear(&mut self) { |
| 503 | self.len = 0; |
| 504 | #[cfg(feature = "pool")] |
| 505 | { |
| 506 | if let Some(reservation) = self.reservation.lock().unwrap().as_mut() { |
| 507 | reservation.resize(self.len); |
| 508 | } |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | /// Returns the data stored in this buffer as a slice. |
| 513 | pub fn as_slice(&self) -> &[u8] { |