diff options
author | John Ericson <git@JohnEricson.me> | 2020-03-22 23:43:07 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-03-25 16:12:14 -0400 |
commit | e433d4af4cf78c88dc0cb3e8139e835470b72fd3 (patch) | |
tree | ff8d812a87c86f0418394e87a7fd4d17f2886929 /src/libstore/path.hh | |
parent | eb1911e277bfcc1b161cb996205ae1696f496099 (diff) |
Extend Rust FFI
Do idiomatic C++ copy and move constructors for a few things, so
wrapping structs' defaults can work.
Diffstat (limited to 'src/libstore/path.hh')
-rw-r--r-- | src/libstore/path.hh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/path.hh b/src/libstore/path.hh index c90bb1fff..186976855 100644 --- a/src/libstore/path.hh +++ b/src/libstore/path.hh @@ -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 |