aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/rust-ffi.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-12-13 19:10:39 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-12-13 19:10:39 +0100
commitac9cc2ec08e95910ecb73745cb011596a33723f0 (patch)
tree24ac2a81d83b0a71d094e57d38c6a67266302607 /src/libutil/rust-ffi.cc
parentb4edc3ca61c1f1a98052ec8ffc41d1b533b08fd7 (diff)
Move some code
Diffstat (limited to 'src/libutil/rust-ffi.cc')
-rw-r--r--src/libutil/rust-ffi.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libutil/rust-ffi.cc b/src/libutil/rust-ffi.cc
index 6f36b3192..8b8b7b75d 100644
--- a/src/libutil/rust-ffi.cc
+++ b/src/libutil/rust-ffi.cc
@@ -19,4 +19,15 @@ std::ostream & operator << (std::ostream & str, const String & s)
return str;
}
+size_t Source::sourceWrapper(void * _this, rust::Slice<uint8_t> data)
+{
+ try {
+ // FIXME: how to propagate exceptions?
+ auto n = ((nix::Source *) _this)->read((unsigned char *) data.ptr, data.size);
+ return n;
+ } catch (...) {
+ abort();
+ }
+}
+
}