diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-12-13 18:29:16 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-12-13 19:05:26 +0100 |
commit | ca87707c90c05289d0c7c1015f5750f6dd93708b (patch) | |
tree | 4364240709b658c599e12b79bff040b72c9afc3e /nix-rust/src/foreign.rs | |
parent | 5a6d6da7aea23a48126a77f98612518af66bc203 (diff) |
Get rid of CBox
Diffstat (limited to 'nix-rust/src/foreign.rs')
-rw-r--r-- | nix-rust/src/foreign.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/nix-rust/src/foreign.rs b/nix-rust/src/foreign.rs index 8e04280f3..7bce7753c 100644 --- a/nix-rust/src/foreign.rs +++ b/nix-rust/src/foreign.rs @@ -12,22 +12,3 @@ impl std::io::Read for Source { Ok(n) } } - -pub struct CBox<T> { - pub ptr: *mut libc::c_void, - phantom: std::marker::PhantomData<T>, -} - -impl<T> CBox<T> { - pub fn new(t: T) -> Self { - unsafe { - let size = std::mem::size_of::<T>(); - let ptr = libc::malloc(size); - *(ptr as *mut T) = t; // FIXME: probably UB - Self { - ptr, - phantom: std::marker::PhantomData, - } - } - } -} |