+/// Get a string which allows debug introspection of a PaymentSendFailure object
+pub extern "C" fn PaymentSendFailure_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::PaymentSendFailure }).into()}
+/// Checks if two PaymentSendFailures contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn PaymentSendFailure_eq(a: &PaymentSendFailure, b: &PaymentSendFailure) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
+}
+/// An error when attempting to pay a [`Bolt12Invoice`].
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum Bolt12PaymentError {
+ /// The invoice was not requested.
+ UnexpectedInvoice,
+ /// Payment for an invoice with the corresponding [`PaymentId`] was already initiated.
+ DuplicateInvoice,
+ /// The invoice was valid for the corresponding [`PaymentId`], but required unknown features.
+ UnknownRequiredFeatures,
+ /// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed.
+ SendingFailed(
+ crate::lightning::ln::outbound_payment::RetryableSendFailure),
+}
+use lightning::ln::outbound_payment::Bolt12PaymentError as Bolt12PaymentErrorImport;
+pub(crate) type nativeBolt12PaymentError = Bolt12PaymentErrorImport;
+
+impl Bolt12PaymentError {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeBolt12PaymentError {
+ match self {
+ Bolt12PaymentError::UnexpectedInvoice => nativeBolt12PaymentError::UnexpectedInvoice,
+ Bolt12PaymentError::DuplicateInvoice => nativeBolt12PaymentError::DuplicateInvoice,
+ Bolt12PaymentError::UnknownRequiredFeatures => nativeBolt12PaymentError::UnknownRequiredFeatures,
+ Bolt12PaymentError::SendingFailed (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeBolt12PaymentError::SendingFailed (
+ a_nonref.into_native(),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeBolt12PaymentError {
+ match self {
+ Bolt12PaymentError::UnexpectedInvoice => nativeBolt12PaymentError::UnexpectedInvoice,
+ Bolt12PaymentError::DuplicateInvoice => nativeBolt12PaymentError::DuplicateInvoice,
+ Bolt12PaymentError::UnknownRequiredFeatures => nativeBolt12PaymentError::UnknownRequiredFeatures,
+ Bolt12PaymentError::SendingFailed (mut a, ) => {
+ nativeBolt12PaymentError::SendingFailed (
+ a.into_native(),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &Bolt12PaymentErrorImport) -> Self {
+ let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt12PaymentError) };
+ match native {
+ nativeBolt12PaymentError::UnexpectedInvoice => Bolt12PaymentError::UnexpectedInvoice,
+ nativeBolt12PaymentError::DuplicateInvoice => Bolt12PaymentError::DuplicateInvoice,
+ nativeBolt12PaymentError::UnknownRequiredFeatures => Bolt12PaymentError::UnknownRequiredFeatures,
+ nativeBolt12PaymentError::SendingFailed (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ Bolt12PaymentError::SendingFailed (
+ crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a_nonref),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeBolt12PaymentError) -> Self {
+ match native {
+ nativeBolt12PaymentError::UnexpectedInvoice => Bolt12PaymentError::UnexpectedInvoice,
+ nativeBolt12PaymentError::DuplicateInvoice => Bolt12PaymentError::DuplicateInvoice,
+ nativeBolt12PaymentError::UnknownRequiredFeatures => Bolt12PaymentError::UnknownRequiredFeatures,
+ nativeBolt12PaymentError::SendingFailed (mut a, ) => {
+ Bolt12PaymentError::SendingFailed (
+ crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a),
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the Bolt12PaymentError
+#[no_mangle]
+pub extern "C" fn Bolt12PaymentError_free(this_ptr: Bolt12PaymentError) { }
+/// Creates a copy of the Bolt12PaymentError
+#[no_mangle]
+pub extern "C" fn Bolt12PaymentError_clone(orig: &Bolt12PaymentError) -> Bolt12PaymentError {
+ orig.clone()
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12PaymentError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt12PaymentError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12PaymentError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt12PaymentError) };
+}
+#[no_mangle]
+/// Utility method to constructs a new UnexpectedInvoice-variant Bolt12PaymentError
+pub extern "C" fn Bolt12PaymentError_unexpected_invoice() -> Bolt12PaymentError {
+ Bolt12PaymentError::UnexpectedInvoice}
+#[no_mangle]
+/// Utility method to constructs a new DuplicateInvoice-variant Bolt12PaymentError
+pub extern "C" fn Bolt12PaymentError_duplicate_invoice() -> Bolt12PaymentError {
+ Bolt12PaymentError::DuplicateInvoice}
+#[no_mangle]
+/// Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12PaymentError
+pub extern "C" fn Bolt12PaymentError_unknown_required_features() -> Bolt12PaymentError {
+ Bolt12PaymentError::UnknownRequiredFeatures}
+#[no_mangle]
+/// Utility method to constructs a new SendingFailed-variant Bolt12PaymentError
+pub extern "C" fn Bolt12PaymentError_sending_failed(a: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> Bolt12PaymentError {
+ Bolt12PaymentError::SendingFailed(a, )
+}
+/// Get a string which allows debug introspection of a Bolt12PaymentError object
+pub extern "C" fn Bolt12PaymentError_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::Bolt12PaymentError }).into()}
+/// Checks if two Bolt12PaymentErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn Bolt12PaymentError_eq(a: &Bolt12PaymentError, b: &Bolt12PaymentError) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
+}
+/// Indicates that we failed to send a payment probe. Further errors may be surfaced later via
+/// [`Event::ProbeFailed`].
+///
+/// [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum ProbeSendFailure {
+ /// We were unable to find a route to the destination.
+ RouteNotFound,
+ /// We failed to send the payment probes.
+ SendingFailed(
+ crate::lightning::ln::outbound_payment::PaymentSendFailure),
+}
+use lightning::ln::outbound_payment::ProbeSendFailure as ProbeSendFailureImport;
+pub(crate) type nativeProbeSendFailure = ProbeSendFailureImport;
+
+impl ProbeSendFailure {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeProbeSendFailure {
+ match self {
+ ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound,
+ ProbeSendFailure::SendingFailed (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeProbeSendFailure::SendingFailed (
+ a_nonref.into_native(),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeProbeSendFailure {
+ match self {
+ ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound,
+ ProbeSendFailure::SendingFailed (mut a, ) => {
+ nativeProbeSendFailure::SendingFailed (
+ a.into_native(),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &ProbeSendFailureImport) -> Self {
+ let native = unsafe { &*(native as *const _ as *const c_void as *const nativeProbeSendFailure) };
+ match native {
+ nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound,
+ nativeProbeSendFailure::SendingFailed (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ ProbeSendFailure::SendingFailed (
+ crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a_nonref),
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeProbeSendFailure) -> Self {
+ match native {
+ nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound,
+ nativeProbeSendFailure::SendingFailed (mut a, ) => {
+ ProbeSendFailure::SendingFailed (
+ crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a),
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the ProbeSendFailure
+#[no_mangle]
+pub extern "C" fn ProbeSendFailure_free(this_ptr: ProbeSendFailure) { }
+/// Creates a copy of the ProbeSendFailure
+#[no_mangle]
+pub extern "C" fn ProbeSendFailure_clone(orig: &ProbeSendFailure) -> ProbeSendFailure {
+ orig.clone()
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbeSendFailure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ProbeSendFailure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbeSendFailure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ProbeSendFailure) };
+}
+#[no_mangle]
+/// Utility method to constructs a new RouteNotFound-variant ProbeSendFailure
+pub extern "C" fn ProbeSendFailure_route_not_found() -> ProbeSendFailure {
+ ProbeSendFailure::RouteNotFound}
+#[no_mangle]
+/// Utility method to constructs a new SendingFailed-variant ProbeSendFailure
+pub extern "C" fn ProbeSendFailure_sending_failed(a: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> ProbeSendFailure {
+ ProbeSendFailure::SendingFailed(a, )
+}
+/// Get a string which allows debug introspection of a ProbeSendFailure object
+pub extern "C" fn ProbeSendFailure_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::ProbeSendFailure }).into()}
+/// Checks if two ProbeSendFailures contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ProbeSendFailure_eq(a: &ProbeSendFailure, b: &ProbeSendFailure) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
+}