X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FResult_InFlightHtlcsDecodeErrorZ.java;h=d40acacb0d633db82ea1ae37dedf4433f9e256cb;hb=330ca992be304d0eac79bd59b411980dff294b03;hp=244f783f53d1d9a73e7ee28ca378acda8c63d849;hpb=1852c471e433c02edcae4803ba52bfec05c5631c;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java index 244f783f..d40acacb 100644 --- a/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java @@ -45,27 +45,19 @@ public class Result_InFlightHtlcsDecodeErrorZ extends CommonBase { /** * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ - public static Result_InFlightHtlcsDecodeErrorZ ok(InFlightHtlcs o) { + public static Result_InFlightHtlcsDecodeErrorZ ok(org.ldk.structs.InFlightHtlcs o) { long ret = bindings.CResult_InFlightHtlcsDecodeErrorZ_ok(o == null ? 0 : o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InFlightHtlcsDecodeErrorZ ret_hu_conv = Result_InFlightHtlcsDecodeErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - // Due to rust's strict-ownership memory model, in some cases we need to "move" - // an object to pass exclusive ownership to the function being called. - // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object - // at the FFI layer, creating a new object which Rust can claim ownership of - // However, in some cases (eg here), there is no way to clone an object, and thus - // we actually have to pass full ownership to Rust. - // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object. - o.ptr = 0;; return ret_hu_conv; } /** * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. */ - public static Result_InFlightHtlcsDecodeErrorZ err(DecodeError e) { + public static Result_InFlightHtlcsDecodeErrorZ err(org.ldk.structs.DecodeError e) { long ret = bindings.CResult_InFlightHtlcsDecodeErrorZ_err(e.ptr); Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } @@ -82,4 +74,22 @@ public class Result_InFlightHtlcsDecodeErrorZ extends CommonBase { return ret; } + long clone_ptr() { + long ret = bindings.CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_InFlightHtlcsDecodeErrorZ clone() { + long ret = bindings.CResult_InFlightHtlcsDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InFlightHtlcsDecodeErrorZ ret_hu_conv = Result_InFlightHtlcsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + }