1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 05:21:16 +02:00

Extend Rust FFI

Do idiomatic C++ copy and move constructors for a few things, so
wrapping structs' defaults can work.
This commit is contained in:
John Ericson 2020-03-22 23:43:07 -04:00 committed by John Ericson
parent eb1911e277
commit e433d4af4c
8 changed files with 63 additions and 21 deletions

View file

@ -13,6 +13,7 @@ extern "C" {
void ffi_StorePath_drop(void *);
bool ffi_StorePath_less_than(const StorePath & a, const StorePath & b);
bool ffi_StorePath_eq(const StorePath & a, const StorePath & b);
void ffi_StorePath_clone_to(const StorePath & _other, StorePath & _this);
unsigned char * ffi_StorePath_hash_data(const StorePath & p);
}
@ -43,6 +44,19 @@ struct StorePath : rust::Value<3 * sizeof(void *) + 24, ffi_StorePath_drop>
return !(*this == other);
}
StorePath(StorePath && that) = default;
StorePath(const StorePath & that)
{
ffi_StorePath_clone_to(that, *this);
}
void operator = (const StorePath & that)
{
(rust::Value<3 * sizeof(void *) + 24, ffi_StorePath_drop>::operator = (that));
ffi_StorePath_clone_to(that, *this);
}
StorePath clone() const;
/* Check whether a file name ends with the extension for