Skip to content

Commit c229735

Browse files
committed
Update auto-generated bindings
1 parent 4b04f3f commit c229735

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

lightning-c-bindings/include/lightning.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,6 +4150,8 @@ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(st
41504150

41514151
void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
41524152

4153+
struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
4154+
41534155
struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
41544156

41554157
struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
@@ -4184,6 +4186,8 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(
41844186

41854187
void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
41864188

4189+
struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
4190+
41874191
struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
41884192

41894193
void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
@@ -6149,6 +6153,18 @@ struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR
61496153

61506154
void Init_free(struct LDKInit this_ptr);
61516155

6156+
/**
6157+
* The relevant features which the sender supports
6158+
*/
6159+
struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
6160+
6161+
/**
6162+
* The relevant features which the sender supports
6163+
*/
6164+
void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
6165+
6166+
MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
6167+
61526168
struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
61536169

61546170
void ErrorMessage_free(struct LDKErrorMessage this_ptr);
@@ -8772,6 +8788,8 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id
87728788

87738789
void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
87748790

8791+
struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
8792+
87758793
void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
87768794

87778795
void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
@@ -8952,6 +8970,8 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct
89528970
*/
89538971
void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
89548972

8973+
struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
8974+
89558975
struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
89568976

89578977
struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);

lightning-c-bindings/src/c_types/derived.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,21 @@ impl From<crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInf
19401940
}
19411941
}
19421942
}
1943+
impl Clone for CResult_ChannelInfoDecodeErrorZ {
1944+
fn clone(&self) -> Self {
1945+
if self.result_ok {
1946+
Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
1947+
result: Box::into_raw(Box::new(<crate::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
1948+
} }
1949+
} else {
1950+
Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
1951+
err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1952+
} }
1953+
}
1954+
}
1955+
}
1956+
#[no_mangle]
1957+
pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
19431958
#[repr(C)]
19441959
pub union CResult_RoutingFeesDecodeErrorZPtr {
19451960
pub result: *mut crate::routing::network_graph::RoutingFees,
@@ -2305,6 +2320,21 @@ impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGra
23052320
}
23062321
}
23072322
}
2323+
impl Clone for CResult_NetworkGraphDecodeErrorZ {
2324+
fn clone(&self) -> Self {
2325+
if self.result_ok {
2326+
Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
2327+
result: Box::into_raw(Box::new(<crate::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
2328+
} }
2329+
} else {
2330+
Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
2331+
err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2332+
} }
2333+
}
2334+
}
2335+
}
2336+
#[no_mangle]
2337+
pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
23082338
#[repr(C)]
23092339
pub struct C2Tuple_usizeTransactionZ {
23102340
pub a: usize,

lightning-c-bindings/src/ln/msgs.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ impl Init {
113113
ret
114114
}
115115
}
116+
/// The relevant features which the sender supports
117+
#[no_mangle]
118+
pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::ln::features::InitFeatures {
119+
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
120+
crate::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
121+
}
122+
/// The relevant features which the sender supports
123+
#[no_mangle]
124+
pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::ln::features::InitFeatures) {
125+
unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
126+
}
127+
#[must_use]
128+
#[no_mangle]
129+
pub extern "C" fn Init_new(mut features_arg: crate::ln::features::InitFeatures) -> Init {
130+
Init { inner: Box::into_raw(Box::new(nativeInit {
131+
features: *unsafe { Box::from_raw(features_arg.take_inner()) },
132+
})), is_owned: true }
133+
}
116134
impl Clone for Init {
117135
fn clone(&self) -> Self {
118136
Self {

lightning-c-bindings/src/routing/network_graph.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ impl NetworkGraph {
4242
ret
4343
}
4444
}
45+
impl Clone for NetworkGraph {
46+
fn clone(&self) -> Self {
47+
Self {
48+
inner: if self.inner.is_null() { std::ptr::null_mut() } else {
49+
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
50+
is_owned: true,
51+
}
52+
}
53+
}
54+
#[allow(unused)]
55+
/// Used only if an object of this type is returned as a trait impl by a method
56+
pub(crate) extern "C" fn NetworkGraph_clone_void(this_ptr: *const c_void) -> *mut c_void {
57+
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void
58+
}
59+
#[no_mangle]
60+
pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
61+
orig.clone()
62+
}
4563

4664
use lightning::routing::network_graph::LockedNetworkGraph as nativeLockedNetworkGraphImport;
4765
type nativeLockedNetworkGraph = nativeLockedNetworkGraphImport<'static>;
@@ -559,6 +577,24 @@ pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInf
559577
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
560578
unsafe { &mut *this_ptr.inner }.announcement_message = local_val;
561579
}
580+
impl Clone for ChannelInfo {
581+
fn clone(&self) -> Self {
582+
Self {
583+
inner: if self.inner.is_null() { std::ptr::null_mut() } else {
584+
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
585+
is_owned: true,
586+
}
587+
}
588+
}
589+
#[allow(unused)]
590+
/// Used only if an object of this type is returned as a trait impl by a method
591+
pub(crate) extern "C" fn ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
592+
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelInfo)).clone() })) as *mut c_void
593+
}
594+
#[no_mangle]
595+
pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
596+
orig.clone()
597+
}
562598
#[no_mangle]
563599
pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
564600
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })

0 commit comments

Comments
 (0)