impl Clone on various public (mostly BOLT12) types

This is required for bindings as passing types from Rust to GC'd
languages can't map the concept of a type that has a lifetime of
the called function but instead needs to clone for safety.
This commit is contained in:
Matt Corallo 2024-05-13 14:36:01 +00:00
parent 7e69d835b2
commit bccddcaabd
5 changed files with 6 additions and 1 deletions

View file

@ -26,7 +26,7 @@ use crate::prelude::*;
use core::ops::Deref;
/// Invalid inbound onion payment.
#[derive(Debug)]
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct InboundHTLCErr {
/// BOLT 4 error code.
pub err_code: u16,

View file

@ -503,6 +503,7 @@ for InvoiceBuilder<'a, DerivedSigningPubkey> {
///
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
/// such, it may include unknown, odd TLV records.
#[derive(Clone)]
pub struct UnsignedBolt12Invoice {
bytes: Vec<u8>,
contents: InvoiceContents,

View file

@ -487,6 +487,7 @@ for InvoiceRequestBuilder<'a, 'b, DerivedPayerId, secp256k1::All> {
///
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
/// such, it may include unknown, odd TLV records.
#[derive(Clone)]
pub struct UnsignedInvoiceRequest {
bytes: Vec<u8>,
contents: InvoiceRequestContents,

View file

@ -165,6 +165,7 @@ pub struct OfferBuilder<'a, M: MetadataStrategy, T: secp256k1::Signing> {
///
/// [module-level documentation]: self
#[cfg(c_bindings)]
#[derive(Clone)]
pub struct OfferWithExplicitMetadataBuilder<'a> {
offer: OfferContents,
metadata_strategy: core::marker::PhantomData<ExplicitMetadata>,
@ -177,6 +178,7 @@ pub struct OfferWithExplicitMetadataBuilder<'a> {
///
/// [module-level documentation]: self
#[cfg(c_bindings)]
#[derive(Clone)]
pub struct OfferWithDerivedMetadataBuilder<'a> {
offer: OfferContents,
metadata_strategy: core::marker::PhantomData<DerivedMetadata>,

View file

@ -141,6 +141,7 @@ pub struct RefundBuilder<'a, T: secp256k1::Signing> {
///
/// [module-level documentation]: self
#[cfg(c_bindings)]
#[derive(Clone)]
pub struct RefundMaybeWithDerivedMetadataBuilder<'a> {
refund: RefundContents,
secp_ctx: Option<&'a Secp256k1<secp256k1::All>>,