mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-17 00:00:14 +02:00
Make BufMut an unsafe trait (#432)
Users of `BufMut` are unable to defend against incorrect implementations of `BufMut`, this makes the trait unsafe to implement. Fixes #329
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ impl<T> Limit<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: BufMut> BufMut for Limit<T> {
|
||||
unsafe impl<T: BufMut> BufMut for Limit<T> {
|
||||
fn remaining_mut(&self) -> usize {
|
||||
cmp::min(self.inner.remaining_mut(), self.limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user