mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Move some code
This commit is contained in:
parent
b4edc3ca61
commit
ac9cc2ec08
2 changed files with 12 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -140,12 +140,7 @@ struct Source
|
|||
: fun(sourceWrapper), _this(&_this)
|
||||
{}
|
||||
|
||||
// FIXME: how to propagate exceptions?
|
||||
static size_t sourceWrapper(void * _this, rust::Slice<uint8_t> data)
|
||||
{
|
||||
auto n = ((nix::Source *) _this)->read((unsigned char *) data.ptr, data.size);
|
||||
return n;
|
||||
}
|
||||
static size_t sourceWrapper(void * _this, rust::Slice<uint8_t> data);
|
||||
};
|
||||
|
||||
/* C++ representation of Rust's Result<T, CppException>. */
|
||||
|
|
Loading…
Reference in a new issue