Skip to content

Commit a211778

Browse files
committed
Update auto-generated bindings
1 parent 6a576b3 commit a211778

33 files changed

+3277
-971
lines changed

lightning-c-bindings/include/ldk_rust_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ struct nativeOnionMessengerOpaque;
197197
typedef struct nativeOnionMessengerOpaque LDKnativeOnionMessenger;
198198
struct nativeRapidGossipSyncOpaque;
199199
typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync;
200-
struct nativeDecodeErrorOpaque;
201-
typedef struct nativeDecodeErrorOpaque LDKnativeDecodeError;
202200
struct nativeInitOpaque;
203201
typedef struct nativeInitOpaque LDKnativeInit;
204202
struct nativeErrorMessageOpaque;

lightning-c-bindings/include/lightning.h

Lines changed: 1233 additions & 286 deletions
Large diffs are not rendered by default.

lightning-c-bindings/include/lightningpp.hpp

Lines changed: 241 additions & 101 deletions
Large diffs are not rendered by default.

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

Lines changed: 203 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,98 +4036,6 @@ impl Clone for CVec_TxidZ {
40364036
}
40374037
}
40384038
#[repr(C)]
4039-
/// The contents of CResult_NoneChannelMonitorUpdateErrZ
4040-
pub union CResult_NoneChannelMonitorUpdateErrZPtr {
4041-
/// Note that this value is always NULL, as there are no contents in the OK variant
4042-
pub result: *mut core::ffi::c_void,
4043-
/// A pointer to the contents in the error state.
4044-
/// Reading from this pointer when `result_ok` is set is undefined.
4045-
pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
4046-
}
4047-
#[repr(C)]
4048-
/// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4049-
/// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4050-
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4051-
pub struct CResult_NoneChannelMonitorUpdateErrZ {
4052-
/// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4053-
/// `err` or `result` depending on the state of `result_ok`.
4054-
pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
4055-
/// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4056-
pub result_ok: bool,
4057-
}
4058-
#[no_mangle]
4059-
/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
4060-
pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
4061-
CResult_NoneChannelMonitorUpdateErrZ {
4062-
contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4063-
result: core::ptr::null_mut(),
4064-
},
4065-
result_ok: true,
4066-
}
4067-
}
4068-
#[no_mangle]
4069-
/// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
4070-
pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
4071-
CResult_NoneChannelMonitorUpdateErrZ {
4072-
contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4073-
err: Box::into_raw(Box::new(e)),
4074-
},
4075-
result_ok: false,
4076-
}
4077-
}
4078-
/// Checks if the given object is currently in the success state
4079-
#[no_mangle]
4080-
pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
4081-
o.result_ok
4082-
}
4083-
#[no_mangle]
4084-
/// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
4085-
pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
4086-
impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
4087-
fn drop(&mut self) {
4088-
if self.result_ok {
4089-
} else {
4090-
if unsafe { !(self.contents.err as *mut ()).is_null() } {
4091-
let _ = unsafe { Box::from_raw(self.contents.err) };
4092-
}
4093-
}
4094-
}
4095-
}
4096-
impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
4097-
fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
4098-
let contents = if o.result_ok {
4099-
let _ = unsafe { Box::from_raw(o.contents.result) };
4100-
o.contents.result = core::ptr::null_mut();
4101-
CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
4102-
} else {
4103-
let err = unsafe { o.contents.err };
4104-
unsafe { o.contents.err = core::ptr::null_mut(); }
4105-
CResult_NoneChannelMonitorUpdateErrZPtr { err }
4106-
};
4107-
Self {
4108-
contents,
4109-
result_ok: o.result_ok,
4110-
}
4111-
}
4112-
}
4113-
impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
4114-
fn clone(&self) -> Self {
4115-
if self.result_ok {
4116-
Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4117-
result: core::ptr::null_mut()
4118-
} }
4119-
} else {
4120-
Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
4121-
err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
4122-
} }
4123-
}
4124-
}
4125-
}
4126-
#[no_mangle]
4127-
/// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
4128-
/// but with all dynamically-allocated buffers duplicated in new buffers.
4129-
pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
4130-
#[repr(C)]
41314039
/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
41324040
/// This corresponds to std::vector in C++
41334041
pub struct CVec_MonitorEventZ {
@@ -7065,6 +6973,98 @@ impl Clone for CResult_SecretKeyNoneZ {
70656973
/// but with all dynamically-allocated buffers duplicated in new buffers.
70666974
pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
70676975
#[repr(C)]
6976+
/// The contents of CResult_PublicKeyNoneZ
6977+
pub union CResult_PublicKeyNoneZPtr {
6978+
/// A pointer to the contents in the success state.
6979+
/// Reading from this pointer when `result_ok` is not set is undefined.
6980+
pub result: *mut crate::c_types::PublicKey,
6981+
/// Note that this value is always NULL, as there are no contents in the Err variant
6982+
pub err: *mut core::ffi::c_void,
6983+
}
6984+
#[repr(C)]
6985+
/// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
6986+
/// containing a crate::c_types::PublicKey on success and a () on failure.
6987+
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6988+
pub struct CResult_PublicKeyNoneZ {
6989+
/// The contents of this CResult_PublicKeyNoneZ, accessible via either
6990+
/// `err` or `result` depending on the state of `result_ok`.
6991+
pub contents: CResult_PublicKeyNoneZPtr,
6992+
/// Whether this CResult_PublicKeyNoneZ represents a success state.
6993+
pub result_ok: bool,
6994+
}
6995+
#[no_mangle]
6996+
/// Creates a new CResult_PublicKeyNoneZ in the success state.
6997+
pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
6998+
CResult_PublicKeyNoneZ {
6999+
contents: CResult_PublicKeyNoneZPtr {
7000+
result: Box::into_raw(Box::new(o)),
7001+
},
7002+
result_ok: true,
7003+
}
7004+
}
7005+
#[no_mangle]
7006+
/// Creates a new CResult_PublicKeyNoneZ in the error state.
7007+
pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7008+
CResult_PublicKeyNoneZ {
7009+
contents: CResult_PublicKeyNoneZPtr {
7010+
err: core::ptr::null_mut(),
7011+
},
7012+
result_ok: false,
7013+
}
7014+
}
7015+
/// Checks if the given object is currently in the success state
7016+
#[no_mangle]
7017+
pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7018+
o.result_ok
7019+
}
7020+
#[no_mangle]
7021+
/// Frees any resources used by the CResult_PublicKeyNoneZ.
7022+
pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7023+
impl Drop for CResult_PublicKeyNoneZ {
7024+
fn drop(&mut self) {
7025+
if self.result_ok {
7026+
if unsafe { !(self.contents.result as *mut ()).is_null() } {
7027+
let _ = unsafe { Box::from_raw(self.contents.result) };
7028+
}
7029+
} else {
7030+
}
7031+
}
7032+
}
7033+
impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7034+
fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7035+
let contents = if o.result_ok {
7036+
let result = unsafe { o.contents.result };
7037+
unsafe { o.contents.result = core::ptr::null_mut() };
7038+
CResult_PublicKeyNoneZPtr { result }
7039+
} else {
7040+
let _ = unsafe { Box::from_raw(o.contents.err) };
7041+
o.contents.err = core::ptr::null_mut();
7042+
CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7043+
};
7044+
Self {
7045+
contents,
7046+
result_ok: o.result_ok,
7047+
}
7048+
}
7049+
}
7050+
impl Clone for CResult_PublicKeyNoneZ {
7051+
fn clone(&self) -> Self {
7052+
if self.result_ok {
7053+
Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7054+
result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7055+
} }
7056+
} else {
7057+
Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7058+
err: core::ptr::null_mut()
7059+
} }
7060+
}
7061+
}
7062+
}
7063+
#[no_mangle]
7064+
/// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7065+
/// but with all dynamically-allocated buffers duplicated in new buffers.
7066+
pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7067+
#[repr(C)]
70687068
/// An enum which can either contain a crate::c_types::BigEndianScalar or not
70697069
pub enum COption_ScalarZ {
70707070
/// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
@@ -12252,6 +12252,117 @@ impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
1225212252
}
1225312253
}
1225412254
#[repr(C)]
12255+
/// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12256+
pub enum COption_CustomOnionMessageContentsZ {
12257+
/// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12258+
Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12259+
/// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12260+
None
12261+
}
12262+
impl COption_CustomOnionMessageContentsZ {
12263+
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12264+
if let Self::None = self { false } else { true }
12265+
}
12266+
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12267+
!self.is_some()
12268+
}
12269+
#[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12270+
if let Self::Some(v) = self { v } else { unreachable!() }
12271+
}
12272+
}
12273+
#[no_mangle]
12274+
/// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12275+
pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12276+
COption_CustomOnionMessageContentsZ::Some(o)
12277+
}
12278+
#[no_mangle]
12279+
/// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12280+
pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12281+
COption_CustomOnionMessageContentsZ::None
12282+
}
12283+
#[no_mangle]
12284+
/// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12285+
pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12286+
#[repr(C)]
12287+
/// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12288+
pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12289+
/// A pointer to the contents in the success state.
12290+
/// Reading from this pointer when `result_ok` is not set is undefined.
12291+
pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12292+
/// A pointer to the contents in the error state.
12293+
/// Reading from this pointer when `result_ok` is set is undefined.
12294+
pub err: *mut crate::lightning::ln::msgs::DecodeError,
12295+
}
12296+
#[repr(C)]
12297+
/// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12298+
/// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12299+
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12300+
pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12301+
/// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12302+
/// `err` or `result` depending on the state of `result_ok`.
12303+
pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12304+
/// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12305+
pub result_ok: bool,
12306+
}
12307+
#[no_mangle]
12308+
/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12309+
pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12310+
CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12311+
contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12312+
result: Box::into_raw(Box::new(o)),
12313+
},
12314+
result_ok: true,
12315+
}
12316+
}
12317+
#[no_mangle]
12318+
/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12319+
pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12320+
CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12321+
contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12322+
err: Box::into_raw(Box::new(e)),
12323+
},
12324+
result_ok: false,
12325+
}
12326+
}
12327+
/// Checks if the given object is currently in the success state
12328+
#[no_mangle]
12329+
pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12330+
o.result_ok
12331+
}
12332+
#[no_mangle]
12333+
/// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12334+
pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12335+
impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12336+
fn drop(&mut self) {
12337+
if self.result_ok {
12338+
if unsafe { !(self.contents.result as *mut ()).is_null() } {
12339+
let _ = unsafe { Box::from_raw(self.contents.result) };
12340+
}
12341+
} else {
12342+
if unsafe { !(self.contents.err as *mut ()).is_null() } {
12343+
let _ = unsafe { Box::from_raw(self.contents.err) };
12344+
}
12345+
}
12346+
}
12347+
}
12348+
impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12349+
fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12350+
let contents = if o.result_ok {
12351+
let result = unsafe { o.contents.result };
12352+
unsafe { o.contents.result = core::ptr::null_mut() };
12353+
CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12354+
} else {
12355+
let err = unsafe { o.contents.err };
12356+
unsafe { o.contents.err = core::ptr::null_mut(); }
12357+
CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12358+
};
12359+
Self {
12360+
contents,
12361+
result_ok: o.result_ok,
12362+
}
12363+
}
12364+
}
12365+
#[repr(C)]
1225512366
#[derive(Clone)]
1225612367
/// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
1225712368
pub enum COption_NetAddressZ {

0 commit comments

Comments
 (0)