aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/rust-ffi.cc
diff options
context:
space:
mode:
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();
+ }
+}
+
}