-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
Hello, I was reading through the Encoder's AsyncRead impl:
Lines 40 to 52 in 50db988
| // Write the current buffer to completion. | |
| let local_buf = self.buf.as_mut().unwrap(); | |
| let local_len = local_buf.len(); | |
| let max = buf.len().min(local_buf.len()); | |
| buf[..max].clone_from_slice(&local_buf[..max]); | |
| self.cursor += max; | |
| // Reset values if we're done reading. | |
| if self.cursor == local_len { | |
| self.buf = None; | |
| self.cursor = 0; | |
| }; |
I noticed that self.cursor wasn't being used to slice local_buf. So, it might be possible to copy the same section of local_buf multiple times.
Metadata
Metadata
Assignees
Labels
No labels