+use lightning::routing::router::CandidateRouteHop as CandidateRouteHopImport;
+pub(crate) type nativeCandidateRouteHop = CandidateRouteHopImport<'static, >;
+
+impl CandidateRouteHop {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeCandidateRouteHop {
+ match self {
+ CandidateRouteHop::FirstHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeCandidateRouteHop::FirstHop (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ CandidateRouteHop::PublicHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeCandidateRouteHop::PublicHop (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ CandidateRouteHop::PrivateHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeCandidateRouteHop::PrivateHop (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ CandidateRouteHop::Blinded (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeCandidateRouteHop::Blinded (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ CandidateRouteHop::OneHopBlinded (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeCandidateRouteHop::OneHopBlinded (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeCandidateRouteHop {
+ match self {
+ CandidateRouteHop::FirstHop (mut a, ) => {
+ nativeCandidateRouteHop::FirstHop (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ CandidateRouteHop::PublicHop (mut a, ) => {
+ nativeCandidateRouteHop::PublicHop (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ CandidateRouteHop::PrivateHop (mut a, ) => {
+ nativeCandidateRouteHop::PrivateHop (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ CandidateRouteHop::Blinded (mut a, ) => {
+ nativeCandidateRouteHop::Blinded (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ CandidateRouteHop::OneHopBlinded (mut a, ) => {
+ nativeCandidateRouteHop::OneHopBlinded (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &CandidateRouteHopImport<'_, >) -> Self {
+ let native = unsafe { &*(native as *const _ as *const c_void as *const nativeCandidateRouteHop) };
+ match native {
+ nativeCandidateRouteHop::FirstHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ CandidateRouteHop::FirstHop (
+ crate::lightning::routing::router::FirstHopCandidate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::PublicHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ CandidateRouteHop::PublicHop (
+ crate::lightning::routing::router::PublicHopCandidate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::PrivateHop (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ CandidateRouteHop::PrivateHop (
+ crate::lightning::routing::router::PrivateHopCandidate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::Blinded (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ CandidateRouteHop::Blinded (
+ crate::lightning::routing::router::BlindedPathCandidate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::OneHopBlinded (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ CandidateRouteHop::OneHopBlinded (
+ crate::lightning::routing::router::OneHopBlindedPathCandidate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeCandidateRouteHop) -> Self {
+ match native {
+ nativeCandidateRouteHop::FirstHop (mut a, ) => {
+ CandidateRouteHop::FirstHop (
+ crate::lightning::routing::router::FirstHopCandidate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::PublicHop (mut a, ) => {
+ CandidateRouteHop::PublicHop (
+ crate::lightning::routing::router::PublicHopCandidate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::PrivateHop (mut a, ) => {
+ CandidateRouteHop::PrivateHop (
+ crate::lightning::routing::router::PrivateHopCandidate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::Blinded (mut a, ) => {
+ CandidateRouteHop::Blinded (
+ crate::lightning::routing::router::BlindedPathCandidate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeCandidateRouteHop::OneHopBlinded (mut a, ) => {
+ CandidateRouteHop::OneHopBlinded (
+ crate::lightning::routing::router::OneHopBlindedPathCandidate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the CandidateRouteHop
+#[no_mangle]
+pub extern "C" fn CandidateRouteHop_free(this_ptr: CandidateRouteHop) { }
+/// Creates a copy of the CandidateRouteHop