X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Foffers%2Finvoice_error.rs;h=11b392d7f457e042118f3f815bf9587b49c7a81a;hb=636543d86915837013c3eb1e0a9ea96114ef73fc;hp=069ad78b41cd34f3df19d0d2a1569525ac4b4bf6;hpb=f7105f5bb3fdf379d58286eacd8e44edba686954;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/offers/invoice_error.rs b/lightning-c-bindings/src/lightning/offers/invoice_error.rs index 069ad78..11b392d 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_error.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_error.rs @@ -129,13 +129,16 @@ impl Clone for InvoiceError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceError)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceError)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the InvoiceError pub extern "C" fn InvoiceError_clone(orig: &InvoiceError) -> InvoiceError { orig.clone() } +/// Get a string which allows debug introspection of a InvoiceError object +pub extern "C" fn InvoiceError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::invoice_error::InvoiceError }).into()} use lightning::offers::invoice_error::ErroneousField as nativeErroneousFieldImport; pub(crate) type nativeErroneousField = nativeErroneousFieldImport; @@ -238,19 +241,35 @@ impl Clone for ErroneousField { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ErroneousField_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErroneousField)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeErroneousField)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the ErroneousField pub extern "C" fn ErroneousField_clone(orig: &ErroneousField) -> ErroneousField { orig.clone() } +/// Get a string which allows debug introspection of a ErroneousField object +pub extern "C" fn ErroneousField_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::invoice_error::ErroneousField }).into()} +/// Creates an [`InvoiceError`] with the given message. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceError_from_string(mut s: crate::c_types::Str) -> crate::lightning::offers::invoice_error::InvoiceError { + let mut ret = lightning::offers::invoice_error::InvoiceError::from_string(s.into_string()); + crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +#[no_mangle] +/// Get the string representation of a InvoiceError object +pub extern "C" fn InvoiceError_to_str(o: &crate::lightning::offers::invoice_error::InvoiceError) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read pub extern "C" fn InvoiceError_write(obj: &crate::lightning::offers::invoice_error::InvoiceError) -> 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 InvoiceError_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceError) }) }