tor_bytes::Reader: fix a bug in truncate.

This commit is contained in:
Nick Mathewson 2020-09-12 20:44:57 -04:00
parent a9181131d2
commit 7a72e093f4
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ impl<'a> Reader<'a> {
/// Fewer than `n` bytes may remain if there were not enough bytes
/// to begin with.
pub fn truncate(&mut self, n: usize) {
self.b = &self.b[self.off..self.off + n];
self.b = &self.b[..self.off + n];
}
/// Try to return a slice of `n` bytes from this reader without
/// consuming them.