f738cd4d97
We can now convert Rust Errors to C++ exceptions. At the Rust->C++ FFI boundary, Result<T, Error> will cause Error to be converted to and thrown as a C++ exception.
13 lines
244 B
C++
13 lines
244 B
C++
#include "logging.hh"
|
|
#include "rust.hh"
|
|
|
|
namespace nix {
|
|
|
|
extern "C" std::exception_ptr * make_error(rust::StringSlice s)
|
|
{
|
|
// FIXME: leak
|
|
return new std::exception_ptr(std::make_exception_ptr(Error(std::string(s.ptr, s.size))));
|
|
}
|
|
|
|
}
|