*/
void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
+/**
+ * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_NetAddressu8Z in the success state.
*/
*/
struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
-/**
- * Generates a P2PKH script pubkey from the given [`PubkeyHash`].
- */
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]);
-
-/**
- * Generates a P2SH script pubkey from the given [`ScriptHash`].
- */
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]);
-
/**
* Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
*/
*/
void NetworkGraph_free(struct LDKNetworkGraph this_obj);
+/**
+ * Creates a copy of the NetworkGraph
+ */
+struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+
/**
* Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
*/
}
}
}
+impl Clone for CResult_NetworkGraphDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
/// The contents of CResult_NetAddressu8Z
pub union CResult_NetAddressu8ZPtr {
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
-/// Generates a P2PKH script pubkey from the given [`PubkeyHash`].
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ShutdownScript_new_p2pkh(pubkey_hash: *const [u8; 20]) -> ShutdownScript {
- let mut ret = lightning::ln::script::ShutdownScript::new_p2pkh(&bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *pubkey_hash }.clone())));
- ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Generates a P2SH script pubkey from the given [`ScriptHash`].
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ShutdownScript_new_p2sh(script_hash: *const [u8; 20]) -> ShutdownScript {
- let mut ret = lightning::ln::script::ShutdownScript::new_p2sh(&bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *script_hash }.clone())));
- ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
/// Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
#[must_use]
#[no_mangle]
ret
}
}
+impl Clone for NetworkGraph {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeNetworkGraph>::is_null(self.inner) { std::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn NetworkGraph_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the NetworkGraph
+pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
+ orig.clone()
+}
use lightning::routing::network_graph::ReadOnlyNetworkGraph as nativeReadOnlyNetworkGraphImport;
type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;