diff --git a/parity-util-mem/Cargo.toml b/parity-util-mem/Cargo.toml index c22796d68..1b9bda1b7 100644 --- a/parity-util-mem/Cargo.toml +++ b/parity-util-mem/Cargo.toml @@ -1,13 +1,12 @@ [package] name = "parity-util-mem" -version = "0.1.0" +version = "0.2.0" authors = ["Parity Technologies "] repository = "https://github.com/paritytech/parity-common" description = "Collection of memory related utilities" license = "GPL-3.0" [dependencies] -clear_on_drop = "0.2" cfg-if = "0.1.6" malloc_size_of_derive = "0.1.0" dlmalloc = { version = "0.1", features = ["global"], optional = true } diff --git a/parity-util-mem/src/lib.rs b/parity-util-mem/src/lib.rs index 7e2ba7068..d98d07a5e 100644 --- a/parity-util-mem/src/lib.rs +++ b/parity-util-mem/src/lib.rs @@ -31,9 +31,6 @@ extern crate alloc; extern crate malloc_size_of_derive as malloc_size_derive; -use std::ops::{Deref, DerefMut}; - -use std::ptr; cfg_if! { if #[cfg(all( @@ -91,42 +88,6 @@ pub use malloc_size::{ }; pub use allocators::MallocSizeOfExt; -/// Wrapper to zero out memory when dropped. -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Memzero> { - mem: T, -} - -impl> From for Memzero { - fn from(mem: T) -> Memzero { - Memzero { mem } - } -} - -impl> Drop for Memzero { - fn drop(&mut self) { - unsafe { - for byte_ref in self.mem.as_mut() { - ptr::write_volatile(byte_ref, 0) - } - } - } -} - -impl> Deref for Memzero { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.mem - } -} - -impl> DerefMut for Memzero { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.mem - } -} - #[cfg(feature = "std")] #[cfg(test)] mod test {