From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Wed, 31 May 2023 22:54:10 +0000 (+0000) Subject: Merge pull request #106 from TheBlueMatt/main X-Git-Tag: v0.0.115.1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Ftags%2Fv0.0.115.1;hp=7ef5b8da9300b88dbaa59c3856d081d3a8edc4e4;p=ldk-c-bindings Merge pull request #106 from TheBlueMatt/main Make `BitEndianScalar` clonable --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index f47bf9e..6e60f82 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -814,6 +814,7 @@ fn initial_clonable_types() -> HashSet { res.insert("crate::c_types::TxOut".to_owned()); res.insert("crate::c_types::Signature".to_owned()); res.insert("crate::c_types::RecoverableSignature".to_owned()); + res.insert("crate::c_types::BigEndianScalar".to_owned()); res.insert("crate::c_types::Bech32Error".to_owned()); res.insert("crate::c_types::Secp256k1Error".to_owned()); res.insert("crate::c_types::IOError".to_owned()); diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 8afabdc..da7fa8e 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -18324,6 +18324,12 @@ struct LDKCOption_ScalarZ COption_ScalarZ_none(void); */ void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); +/** + * Creates a new COption_ScalarZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig); + /** * Creates a new CResult_SharedSecretNoneZ in the success state. */ diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index 9b47257..ad65e75 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -7826,6 +7826,7 @@ impl Clone for CResult_PublicKeyNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) } #[repr(C)] +#[derive(Clone)] /// An enum which can either contain a crate::c_types::BigEndianScalar or not pub enum COption_ScalarZ { /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar @@ -7857,6 +7858,10 @@ pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ { #[no_mangle] /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { } +#[no_mangle] +/// Creates a new COption_ScalarZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_SharedSecretNoneZ pub union CResult_SharedSecretNoneZPtr {