X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fblinded_path%2Fpayment.rs;h=83c3d9b2c72f7592201cfd86977a3bbc9f3d66ab;hb=0ac4dbdb8352c898100b34f0ef8ed9cebfea7786;hp=877661833329fafad6cdf18779b320b5bc4f59af;hpb=f7105f5bb3fdf379d58286eacd8e44edba686954;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/blinded_path/payment.rs b/lightning-c-bindings/src/lightning/blinded_path/payment.rs index 8776618..83c3d9b 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/payment.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/payment.rs @@ -127,13 +127,16 @@ impl Clone for ForwardNode { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ForwardNode_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardNode)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeForwardNode)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the ForwardNode pub extern "C" fn ForwardNode_clone(orig: &ForwardNode) -> ForwardNode { orig.clone() } +/// Get a string which allows debug introspection of a ForwardNode object +pub extern "C" fn ForwardNode_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ForwardNode }).into()} use lightning::blinded_path::payment::ForwardTlvs as nativeForwardTlvsImport; pub(crate) type nativeForwardTlvs = nativeForwardTlvsImport; @@ -258,13 +261,16 @@ impl Clone for ForwardTlvs { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ForwardTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardTlvs)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeForwardTlvs)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the ForwardTlvs pub extern "C" fn ForwardTlvs_clone(orig: &ForwardTlvs) -> ForwardTlvs { orig.clone() } +/// Get a string which allows debug introspection of a ForwardTlvs object +pub extern "C" fn ForwardTlvs_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ForwardTlvs }).into()} use lightning::blinded_path::payment::ReceiveTlvs as nativeReceiveTlvsImport; pub(crate) type nativeReceiveTlvs = nativeReceiveTlvsImport; @@ -360,13 +366,16 @@ impl Clone for ReceiveTlvs { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReceiveTlvs)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReceiveTlvs)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the ReceiveTlvs pub extern "C" fn ReceiveTlvs_clone(orig: &ReceiveTlvs) -> ReceiveTlvs { orig.clone() } +/// Get a string which allows debug introspection of a ReceiveTlvs object +pub extern "C" fn ReceiveTlvs_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ReceiveTlvs }).into()} use lightning::blinded_path::payment::PaymentRelay as nativePaymentRelayImport; pub(crate) type nativePaymentRelay = nativePaymentRelayImport; @@ -477,13 +486,16 @@ impl Clone for PaymentRelay { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PaymentRelay_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentRelay)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentRelay)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentRelay pub extern "C" fn PaymentRelay_clone(orig: &PaymentRelay) -> PaymentRelay { orig.clone() } +/// Get a string which allows debug introspection of a PaymentRelay object +pub extern "C" fn PaymentRelay_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::PaymentRelay }).into()} use lightning::blinded_path::payment::PaymentConstraints as nativePaymentConstraintsImport; pub(crate) type nativePaymentConstraints = nativePaymentConstraintsImport; @@ -537,15 +549,13 @@ impl PaymentConstraints { ret } } -/// The maximum total CLTV delta that is acceptable when relaying a payment over this -/// [`BlindedHop`]. +/// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. #[no_mangle] pub extern "C" fn PaymentConstraints_get_max_cltv_expiry(this_ptr: &PaymentConstraints) -> u32 { let mut inner_val = &mut this_ptr.get_native_mut_ref().max_cltv_expiry; *inner_val } -/// The maximum total CLTV delta that is acceptable when relaying a payment over this -/// [`BlindedHop`]. +/// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. #[no_mangle] pub extern "C" fn PaymentConstraints_set_max_cltv_expiry(this_ptr: &mut PaymentConstraints, mut val: u32) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_cltv_expiry = val; @@ -584,19 +594,22 @@ impl Clone for PaymentConstraints { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PaymentConstraints_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentConstraints)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentConstraints)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentConstraints pub extern "C" fn PaymentConstraints_clone(orig: &PaymentConstraints) -> PaymentConstraints { orig.clone() } +/// Get a string which allows debug introspection of a PaymentConstraints object +pub extern "C" fn PaymentConstraints_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::PaymentConstraints }).into()} #[no_mangle] /// Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read pub extern "C" fn ForwardTlvs_write(obj: &crate::lightning::blinded_path::payment::ForwardTlvs) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -#[no_mangle] +#[allow(unused)] pub(crate) extern "C" fn ForwardTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeForwardTlvs) }) } @@ -605,23 +618,16 @@ pub(crate) extern "C" fn ForwardTlvs_write_void(obj: *const c_void) -> crate::c_ pub extern "C" fn ReceiveTlvs_write(obj: &crate::lightning::blinded_path::payment::ReceiveTlvs) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -#[no_mangle] +#[allow(unused)] pub(crate) extern "C" fn ReceiveTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReceiveTlvs) }) } #[no_mangle] -/// Read a ReceiveTlvs from a byte array, created by ReceiveTlvs_write -pub extern "C" fn ReceiveTlvs_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReceiveTlvsDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_res -} -#[no_mangle] /// Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read pub extern "C" fn PaymentRelay_write(obj: &crate::lightning::blinded_path::payment::PaymentRelay) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -#[no_mangle] +#[allow(unused)] pub(crate) extern "C" fn PaymentRelay_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentRelay) }) } @@ -637,7 +643,7 @@ pub extern "C" fn PaymentRelay_read(ser: crate::c_types::u8slice) -> crate::c_ty pub extern "C" fn PaymentConstraints_write(obj: &crate::lightning::blinded_path::payment::PaymentConstraints) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -#[no_mangle] +#[allow(unused)] pub(crate) extern "C" fn PaymentConstraints_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentConstraints) }) }