aboutsummaryrefslogtreecommitdiff
path: root/nix-rust/src/foreign.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nix-rust/src/foreign.rs')
-rw-r--r--nix-rust/src/foreign.rs14
1 files changed, 0 insertions, 14 deletions
diff --git a/nix-rust/src/foreign.rs b/nix-rust/src/foreign.rs
deleted file mode 100644
index 7bce7753c..000000000
--- a/nix-rust/src/foreign.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-/// A wrapper around Nix's Source class that provides the Read trait.
-#[repr(C)]
-pub struct Source {
- fun: extern "C" fn(this: *mut libc::c_void, data: &mut [u8]) -> usize,
- this: *mut libc::c_void,
-}
-
-impl std::io::Read for Source {
- fn read(&mut self, buf: &mut [u8]) -> std::result::Result<usize, std::io::Error> {
- let n = (self.fun)(self.this, buf);
- assert!(n <= buf.len());
- Ok(n)
- }
-}