+#[no_mangle]
+/// Utility method to constructs a new APIMisuseError-variant APIError
+pub extern "C" fn APIError_apimisuse_error(err: crate::c_types::Str) -> APIError {
+ APIError::APIMisuseError {
+ err,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new FeeRateTooHigh-variant APIError
+pub extern "C" fn APIError_fee_rate_too_high(err: crate::c_types::Str, feerate: u32) -> APIError {
+ APIError::FeeRateTooHigh {
+ err,
+ feerate,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new InvalidRoute-variant APIError
+pub extern "C" fn APIError_invalid_route(err: crate::c_types::Str) -> APIError {
+ APIError::InvalidRoute {
+ err,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new ChannelUnavailable-variant APIError
+pub extern "C" fn APIError_channel_unavailable(err: crate::c_types::Str) -> APIError {
+ APIError::ChannelUnavailable {
+ err,
+ }
+}
+#[no_mangle]
+/// Utility method to constructs a new MonitorUpdateInProgress-variant APIError
+pub extern "C" fn APIError_monitor_update_in_progress() -> APIError {
+ APIError::MonitorUpdateInProgress}
+#[no_mangle]
+/// Utility method to constructs a new IncompatibleShutdownScript-variant APIError
+pub extern "C" fn APIError_incompatible_shutdown_script(script: crate::lightning::ln::script::ShutdownScript) -> APIError {
+ APIError::IncompatibleShutdownScript {
+ script,
+ }
+}
+/// Checks if two APIErrors contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn APIError_eq(a: &APIError, b: &APIError) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
+}
+#[no_mangle]
+/// Serialize the APIError object into a byte array which can be read by APIError_read
+pub extern "C" fn APIError_write(obj: &crate::lightning::util::errors::APIError) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}
+#[no_mangle]
+/// Read a APIError from a byte array, created by APIError_write
+pub extern "C" fn APIError_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_APIErrorZDecodeErrorZ {
+ let res: Result<Option<lightning::util::errors::APIError>, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_APIErrorZ::None } else { crate::c_types::derived::COption_APIErrorZ::Some( { crate::lightning::util::errors::APIError::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+ local_res
+}