X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Foffers%2Foffer.rs;fp=lightning-c-bindings%2Fsrc%2Flightning%2Foffers%2Foffer.rs;h=f9691b4c2af516a68b079c32876807be8a41a556;hp=c4f0c064a72161add6d4e7604a7966c204672ca7;hb=5502fccd64611f16f5ebba3759c68b1a4d69b537;hpb=1ec49fac7433e5b8693c3858a3e25998bc888eeb diff --git a/lightning-c-bindings/src/lightning/offers/offer.rs b/lightning-c-bindings/src/lightning/offers/offer.rs index c4f0c06..f9691b4 100644 --- a/lightning-c-bindings/src/lightning/offers/offer.rs +++ b/lightning-c-bindings/src/lightning/offers/offer.rs @@ -12,6 +12,8 @@ //! published as a QR code to be scanned by a customer. The customer uses the offer to request an //! invoice from the merchant to be paid. //! +//! # Example +//! //! ``` //! extern crate bitcoin; //! extern crate core; @@ -64,6 +66,14 @@ //! # Ok(()) //! # } //! ``` +//! +//! # Note +//! +//! If constructing an [`Offer`] for use with a [`ChannelManager`], use +//! [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`]. +//! +//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +//! [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder use alloc::str::FromStr; use alloc::string::String; @@ -149,7 +159,7 @@ impl Clone for Offer { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Offer_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOffer)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOffer)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the Offer @@ -293,7 +303,7 @@ pub extern "C" fn Offer_expects_quantity(this_arg: &crate::lightning::offers::of pub extern "C" fn Offer_write(obj: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -#[no_mangle] +#[allow(unused)] pub(crate) extern "C" fn Offer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOffer) }) } @@ -361,7 +371,7 @@ impl Clone for Amount { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Amount_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAmount)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAmount)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the Amount @@ -431,7 +441,7 @@ impl Clone for Quantity { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Quantity_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQuantity)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQuantity)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the Quantity