diff --git a/Cargo.toml b/Cargo.toml index 4e057e5..b96e088 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ readme = "README.md" edition = "2021" [dependencies] -safemem = "0.3" memchr = "2.0" # `slice_deque` is only supported on platforms with virtual memory diff --git a/src/buffer/std_buf.rs b/src/buffer/std_buf.rs index c337c7c..1594737 100644 --- a/src/buffer/std_buf.rs +++ b/src/buffer/std_buf.rs @@ -66,7 +66,8 @@ impl StdBuf { // simply move the bytes down to the beginning let len = self.len(); - safemem::copy_over(unsafe { self.buf.as_mut_slice() }, self.pos, 0, len); + let buf_slice = unsafe { self.buf.as_mut_slice() }; + buf_slice.copy_within(self.pos..self.pos+len, 0); self.pos = 0; self.end = len; diff --git a/src/lib.rs b/src/lib.rs index 951a149..48875d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1037,7 +1037,7 @@ impl Buffer { if self.zeroed < cap { unsafe { let buf = self.buf.write_buf(); - safemem::write_bytes(buf, 0); + buf.fill(0); } self.zeroed = cap;