@@ -24030,6 +24030,198 @@ impl Clone for CResult_COption_EventZDecodeErrorZ {
24030
24030
/// but with all dynamically-allocated buffers duplicated in new buffers.
24031
24031
pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
24032
24032
#[repr(C)]
24033
+ /// The contents of CResult_ElectrumSyncClientTxSyncErrorZ
24034
+ pub union CResult_ElectrumSyncClientTxSyncErrorZPtr {
24035
+ /// A pointer to the contents in the success state.
24036
+ /// Reading from this pointer when `result_ok` is not set is undefined.
24037
+ pub result: *mut crate::lightning_transaction_sync::electrum::ElectrumSyncClient,
24038
+ /// A pointer to the contents in the error state.
24039
+ /// Reading from this pointer when `result_ok` is set is undefined.
24040
+ pub err: *mut crate::lightning_transaction_sync::error::TxSyncError,
24041
+ }
24042
+ #[repr(C)]
24043
+ /// A CResult_ElectrumSyncClientTxSyncErrorZ represents the result of a fallible operation,
24044
+ /// containing a crate::lightning_transaction_sync::electrum::ElectrumSyncClient on success and a crate::lightning_transaction_sync::error::TxSyncError on failure.
24045
+ /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24046
+ pub struct CResult_ElectrumSyncClientTxSyncErrorZ {
24047
+ /// The contents of this CResult_ElectrumSyncClientTxSyncErrorZ, accessible via either
24048
+ /// `err` or `result` depending on the state of `result_ok`.
24049
+ pub contents: CResult_ElectrumSyncClientTxSyncErrorZPtr,
24050
+ /// Whether this CResult_ElectrumSyncClientTxSyncErrorZ represents a success state.
24051
+ pub result_ok: bool,
24052
+ }
24053
+ #[no_mangle]
24054
+ /// Creates a new CResult_ElectrumSyncClientTxSyncErrorZ in the success state.
24055
+ pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_ok(o: crate::lightning_transaction_sync::electrum::ElectrumSyncClient) -> CResult_ElectrumSyncClientTxSyncErrorZ {
24056
+ CResult_ElectrumSyncClientTxSyncErrorZ {
24057
+ contents: CResult_ElectrumSyncClientTxSyncErrorZPtr {
24058
+ result: Box::into_raw(Box::new(o)),
24059
+ },
24060
+ result_ok: true,
24061
+ }
24062
+ }
24063
+ #[no_mangle]
24064
+ /// Creates a new CResult_ElectrumSyncClientTxSyncErrorZ in the error state.
24065
+ pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_err(e: crate::lightning_transaction_sync::error::TxSyncError) -> CResult_ElectrumSyncClientTxSyncErrorZ {
24066
+ CResult_ElectrumSyncClientTxSyncErrorZ {
24067
+ contents: CResult_ElectrumSyncClientTxSyncErrorZPtr {
24068
+ err: Box::into_raw(Box::new(e)),
24069
+ },
24070
+ result_ok: false,
24071
+ }
24072
+ }
24073
+ /// Checks if the given object is currently in the success state
24074
+ #[no_mangle]
24075
+ pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_is_ok(o: &CResult_ElectrumSyncClientTxSyncErrorZ) -> bool {
24076
+ o.result_ok
24077
+ }
24078
+ #[no_mangle]
24079
+ /// Frees any resources used by the CResult_ElectrumSyncClientTxSyncErrorZ.
24080
+ pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_free(_res: CResult_ElectrumSyncClientTxSyncErrorZ) { }
24081
+ impl Drop for CResult_ElectrumSyncClientTxSyncErrorZ {
24082
+ fn drop(&mut self) {
24083
+ if self.result_ok {
24084
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
24085
+ let _ = unsafe { Box::from_raw(self.contents.result) };
24086
+ }
24087
+ } else {
24088
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
24089
+ let _ = unsafe { Box::from_raw(self.contents.err) };
24090
+ }
24091
+ }
24092
+ }
24093
+ }
24094
+ impl From<crate::c_types::CResultTempl<crate::lightning_transaction_sync::electrum::ElectrumSyncClient, crate::lightning_transaction_sync::error::TxSyncError>> for CResult_ElectrumSyncClientTxSyncErrorZ {
24095
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_transaction_sync::electrum::ElectrumSyncClient, crate::lightning_transaction_sync::error::TxSyncError>) -> Self {
24096
+ let contents = if o.result_ok {
24097
+ let result = unsafe { o.contents.result };
24098
+ unsafe { o.contents.result = core::ptr::null_mut() };
24099
+ CResult_ElectrumSyncClientTxSyncErrorZPtr { result }
24100
+ } else {
24101
+ let err = unsafe { o.contents.err };
24102
+ unsafe { o.contents.err = core::ptr::null_mut(); }
24103
+ CResult_ElectrumSyncClientTxSyncErrorZPtr { err }
24104
+ };
24105
+ Self {
24106
+ contents,
24107
+ result_ok: o.result_ok,
24108
+ }
24109
+ }
24110
+ }
24111
+ #[repr(C)]
24112
+ /// A dynamically-allocated array of crate::lightning::chain::Confirms of arbitrary size.
24113
+ /// This corresponds to std::vector in C++
24114
+ pub struct CVec_ConfirmZ {
24115
+ /// The elements in the array.
24116
+ /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24117
+ pub data: *mut crate::lightning::chain::Confirm,
24118
+ /// The number of elements pointed to by `data`.
24119
+ pub datalen: usize
24120
+ }
24121
+ impl CVec_ConfirmZ {
24122
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::Confirm> {
24123
+ if self.datalen == 0 { return Vec::new(); }
24124
+ let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24125
+ self.data = core::ptr::null_mut();
24126
+ self.datalen = 0;
24127
+ ret
24128
+ }
24129
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::Confirm] {
24130
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24131
+ }
24132
+ }
24133
+ impl From<Vec<crate::lightning::chain::Confirm>> for CVec_ConfirmZ {
24134
+ fn from(v: Vec<crate::lightning::chain::Confirm>) -> Self {
24135
+ let datalen = v.len();
24136
+ let data = Box::into_raw(v.into_boxed_slice());
24137
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24138
+ }
24139
+ }
24140
+ #[no_mangle]
24141
+ /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24142
+ pub extern "C" fn CVec_ConfirmZ_free(_res: CVec_ConfirmZ) { }
24143
+ impl Drop for CVec_ConfirmZ {
24144
+ fn drop(&mut self) {
24145
+ if self.datalen == 0 { return; }
24146
+ let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24147
+ }
24148
+ }
24149
+ #[repr(C)]
24150
+ /// The contents of CResult_NoneTxSyncErrorZ
24151
+ pub union CResult_NoneTxSyncErrorZPtr {
24152
+ /// Note that this value is always NULL, as there are no contents in the OK variant
24153
+ pub result: *mut core::ffi::c_void,
24154
+ /// A pointer to the contents in the error state.
24155
+ /// Reading from this pointer when `result_ok` is set is undefined.
24156
+ pub err: *mut crate::lightning_transaction_sync::error::TxSyncError,
24157
+ }
24158
+ #[repr(C)]
24159
+ /// A CResult_NoneTxSyncErrorZ represents the result of a fallible operation,
24160
+ /// containing a () on success and a crate::lightning_transaction_sync::error::TxSyncError on failure.
24161
+ /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24162
+ pub struct CResult_NoneTxSyncErrorZ {
24163
+ /// The contents of this CResult_NoneTxSyncErrorZ, accessible via either
24164
+ /// `err` or `result` depending on the state of `result_ok`.
24165
+ pub contents: CResult_NoneTxSyncErrorZPtr,
24166
+ /// Whether this CResult_NoneTxSyncErrorZ represents a success state.
24167
+ pub result_ok: bool,
24168
+ }
24169
+ #[no_mangle]
24170
+ /// Creates a new CResult_NoneTxSyncErrorZ in the success state.
24171
+ pub extern "C" fn CResult_NoneTxSyncErrorZ_ok() -> CResult_NoneTxSyncErrorZ {
24172
+ CResult_NoneTxSyncErrorZ {
24173
+ contents: CResult_NoneTxSyncErrorZPtr {
24174
+ result: core::ptr::null_mut(),
24175
+ },
24176
+ result_ok: true,
24177
+ }
24178
+ }
24179
+ #[no_mangle]
24180
+ /// Creates a new CResult_NoneTxSyncErrorZ in the error state.
24181
+ pub extern "C" fn CResult_NoneTxSyncErrorZ_err(e: crate::lightning_transaction_sync::error::TxSyncError) -> CResult_NoneTxSyncErrorZ {
24182
+ CResult_NoneTxSyncErrorZ {
24183
+ contents: CResult_NoneTxSyncErrorZPtr {
24184
+ err: Box::into_raw(Box::new(e)),
24185
+ },
24186
+ result_ok: false,
24187
+ }
24188
+ }
24189
+ /// Checks if the given object is currently in the success state
24190
+ #[no_mangle]
24191
+ pub extern "C" fn CResult_NoneTxSyncErrorZ_is_ok(o: &CResult_NoneTxSyncErrorZ) -> bool {
24192
+ o.result_ok
24193
+ }
24194
+ #[no_mangle]
24195
+ /// Frees any resources used by the CResult_NoneTxSyncErrorZ.
24196
+ pub extern "C" fn CResult_NoneTxSyncErrorZ_free(_res: CResult_NoneTxSyncErrorZ) { }
24197
+ impl Drop for CResult_NoneTxSyncErrorZ {
24198
+ fn drop(&mut self) {
24199
+ if self.result_ok {
24200
+ } else {
24201
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
24202
+ let _ = unsafe { Box::from_raw(self.contents.err) };
24203
+ }
24204
+ }
24205
+ }
24206
+ }
24207
+ impl From<crate::c_types::CResultTempl<(), crate::lightning_transaction_sync::error::TxSyncError>> for CResult_NoneTxSyncErrorZ {
24208
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_transaction_sync::error::TxSyncError>) -> Self {
24209
+ let contents = if o.result_ok {
24210
+ let _ = unsafe { Box::from_raw(o.contents.result) };
24211
+ o.contents.result = core::ptr::null_mut();
24212
+ CResult_NoneTxSyncErrorZPtr { result: core::ptr::null_mut() }
24213
+ } else {
24214
+ let err = unsafe { o.contents.err };
24215
+ unsafe { o.contents.err = core::ptr::null_mut(); }
24216
+ CResult_NoneTxSyncErrorZPtr { err }
24217
+ };
24218
+ Self {
24219
+ contents,
24220
+ result_ok: o.result_ok,
24221
+ }
24222
+ }
24223
+ }
24224
+ #[repr(C)]
24033
24225
/// The contents of CResult_SiPrefixBolt11ParseErrorZ
24034
24226
pub union CResult_SiPrefixBolt11ParseErrorZPtr {
24035
24227
/// A pointer to the contents in the success state.
0 commit comments