X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fser.rs;h=1235f5cd08206750603fbcb608cc3348c00a0731;hb=636543d86915837013c3eb1e0a9ea96114ef73fc;hp=6b5c46cf187f4d1da5a22d771b49c5093754b326;hpb=0ac4dbdb8352c898100b34f0ef8ed9cebfea7786;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index 6b5c46c..1235f5c 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -262,6 +262,11 @@ pub extern "C" fn Hostname_len(this_arg: &crate::lightning::util::ser::Hostname) ret } +#[no_mangle] +/// Get the string representation of a Hostname object +pub extern "C" fn Hostname_to_str(o: &crate::lightning::util::ser::Hostname) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the Hostname object into a byte array which can be read by Hostname_read pub extern "C" fn Hostname_write(obj: &crate::lightning::util::ser::Hostname) -> crate::c_types::derived::CVec_u8Z { @@ -391,6 +396,14 @@ pub extern "C" fn TransactionU16LenLimited_into_transaction(mut this_arg: crate: crate::c_types::Transaction::from_bitcoin(&ret) } +/// Returns a reference to the contained `Transaction` +#[must_use] +#[no_mangle] +pub extern "C" fn TransactionU16LenLimited_as_transaction(this_arg: &crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::Transaction { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_transaction(); + crate::c_types::Transaction::from_bitcoin(ret) +} + #[no_mangle] /// Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read pub extern "C" fn TransactionU16LenLimited_write(obj: &crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::derived::CVec_u8Z {