-pub extern "C" fn RawTaggedField_free(this_ptr: RawTaggedField) { }
-/// Creates a copy of the RawTaggedField
-#[no_mangle]
-pub extern "C" fn RawTaggedField_clone(orig: &RawTaggedField) -> RawTaggedField {
- orig.clone()
-}
-/// Tagged field with known tag
-///
-/// For descriptions of the enum values please refer to the enclosed type's docs.
-#[must_use]
-#[derive(Clone)]
-#[repr(C)]
-pub enum TaggedField {
- PaymentHash(crate::lightning_invoice::Sha256),
- Description(crate::lightning_invoice::Description),
- PayeePubKey(crate::lightning_invoice::PayeePubKey),
- DescriptionHash(crate::lightning_invoice::Sha256),
- ExpiryTime(crate::lightning_invoice::ExpiryTime),
- MinFinalCltvExpiry(crate::lightning_invoice::MinFinalCltvExpiry),
- Fallback(crate::lightning_invoice::Fallback),
- Route(crate::lightning_invoice::RouteHint),
- PaymentSecret(crate::lightning_invoice::PaymentSecret),
- Features(crate::lightning::ln::features::InvoiceFeatures),
-}
-use lightning_invoice::TaggedField as nativeTaggedField;
-impl TaggedField {
- #[allow(unused)]
- pub(crate) fn to_native(&self) -> nativeTaggedField {
- match self {
- TaggedField::PaymentHash (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::PaymentHash (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::Description (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::Description (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::PayeePubKey (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::PayeePubKey (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::DescriptionHash (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::DescriptionHash (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::ExpiryTime (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::ExpiryTime (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::MinFinalCltvExpiry (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::MinFinalCltvExpiry (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::Fallback (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::Fallback (
- a_nonref.into_native(),
- )
- },
- TaggedField::Route (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::Route (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::PaymentSecret (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::PaymentSecret (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- TaggedField::Features (ref a, ) => {
- let mut a_nonref = (*a).clone();
- nativeTaggedField::Features (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
- )
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn into_native(self) -> nativeTaggedField {
- match self {
- TaggedField::PaymentHash (mut a, ) => {
- nativeTaggedField::PaymentHash (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::Description (mut a, ) => {
- nativeTaggedField::Description (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::PayeePubKey (mut a, ) => {
- nativeTaggedField::PayeePubKey (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::DescriptionHash (mut a, ) => {
- nativeTaggedField::DescriptionHash (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::ExpiryTime (mut a, ) => {
- nativeTaggedField::ExpiryTime (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::MinFinalCltvExpiry (mut a, ) => {
- nativeTaggedField::MinFinalCltvExpiry (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::Fallback (mut a, ) => {
- nativeTaggedField::Fallback (
- a.into_native(),
- )
- },
- TaggedField::Route (mut a, ) => {
- nativeTaggedField::Route (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::PaymentSecret (mut a, ) => {
- nativeTaggedField::PaymentSecret (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- TaggedField::Features (mut a, ) => {
- nativeTaggedField::Features (
- *unsafe { Box::from_raw(a.take_inner()) },
- )
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn from_native(native: &nativeTaggedField) -> Self {
- match native {
- nativeTaggedField::PaymentHash (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::PaymentHash (
- crate::lightning_invoice::Sha256 { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::Description (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::Description (
- crate::lightning_invoice::Description { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::PayeePubKey (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::PayeePubKey (
- crate::lightning_invoice::PayeePubKey { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::DescriptionHash (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::DescriptionHash (
- crate::lightning_invoice::Sha256 { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::ExpiryTime (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::ExpiryTime (
- crate::lightning_invoice::ExpiryTime { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::MinFinalCltvExpiry (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::MinFinalCltvExpiry (
- crate::lightning_invoice::MinFinalCltvExpiry { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::Fallback (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::Fallback (
- crate::lightning_invoice::Fallback::native_into(a_nonref),
- )
- },
- nativeTaggedField::Route (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::Route (
- crate::lightning_invoice::RouteHint { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::PaymentSecret (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::PaymentSecret (
- crate::lightning_invoice::PaymentSecret { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- nativeTaggedField::Features (ref a, ) => {
- let mut a_nonref = (*a).clone();
- TaggedField::Features (
- crate::lightning::ln::features::InvoiceFeatures { inner: Box::into_raw(Box::new(a_nonref)), is_owned: true },
- )
- },
- }
- }
- #[allow(unused)]
- pub(crate) fn native_into(native: nativeTaggedField) -> Self {
- match native {
- nativeTaggedField::PaymentHash (mut a, ) => {
- TaggedField::PaymentHash (
- crate::lightning_invoice::Sha256 { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::Description (mut a, ) => {
- TaggedField::Description (
- crate::lightning_invoice::Description { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::PayeePubKey (mut a, ) => {
- TaggedField::PayeePubKey (
- crate::lightning_invoice::PayeePubKey { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::DescriptionHash (mut a, ) => {
- TaggedField::DescriptionHash (
- crate::lightning_invoice::Sha256 { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::ExpiryTime (mut a, ) => {
- TaggedField::ExpiryTime (
- crate::lightning_invoice::ExpiryTime { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::MinFinalCltvExpiry (mut a, ) => {
- TaggedField::MinFinalCltvExpiry (
- crate::lightning_invoice::MinFinalCltvExpiry { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::Fallback (mut a, ) => {
- TaggedField::Fallback (
- crate::lightning_invoice::Fallback::native_into(a),
- )
- },
- nativeTaggedField::Route (mut a, ) => {
- TaggedField::Route (
- crate::lightning_invoice::RouteHint { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::PaymentSecret (mut a, ) => {
- TaggedField::PaymentSecret (
- crate::lightning_invoice::PaymentSecret { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- nativeTaggedField::Features (mut a, ) => {
- TaggedField::Features (
- crate::lightning::ln::features::InvoiceFeatures { inner: Box::into_raw(Box::new(a)), is_owned: true },
- )
- },
- }
- }
-}
-/// Frees any resources used by the TaggedField
-#[no_mangle]
-pub extern "C" fn TaggedField_free(this_ptr: TaggedField) { }
-/// Creates a copy of the TaggedField
-#[no_mangle]
-pub extern "C" fn TaggedField_clone(orig: &TaggedField) -> TaggedField {
- orig.clone()