Merge pull request #908 from TheBlueMatt/2021-04-invoice-real-bindings
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Sat, 1 May 2021 00:50:25 +0000 (00:50 +0000)
committerGitHub <noreply@github.com>
Sat, 1 May 2021 00:50:25 +0000 (00:50 +0000)
Minor Tweaks to lightning-invoice for C bindings

lightning-invoice/src/de.rs
lightning-invoice/src/lib.rs
lightning-invoice/src/ser.rs

index 4b38c89ec9444932daac0f224567dae1e749282b..3610bc4b67fab01f11283aed957c1fe71ccb4731 100644 (file)
@@ -20,7 +20,9 @@ use secp256k1;
 use secp256k1::recovery::{RecoveryId, RecoverableSignature};
 use secp256k1::key::PublicKey;
 
-use super::*;
+use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
+       SemanticError, RouteHint, Description, RawTaggedField, Currency, RawHrp, SiPrefix, RawInvoice, constants, SignedRawInvoice,
+       RawDataPart, CreationError, InvoiceFeatures};
 
 use self::hrp_sm::parse_hrp;
 
index 461ae9b92ad1a9e4d9bb993c13bae59353e89dd0..cc6049f03603ffd3b907ab7fbe7d41d33c9272ec 100644 (file)
@@ -332,6 +332,8 @@ pub enum Currency {
 }
 
 /// Tagged field which may have an unknown tag
+///
+/// (C-not exported) as we don't currently support TaggedField
 #[derive(Eq, PartialEq, Debug, Clone)]
 pub enum RawTaggedField {
        /// Parsed tagged field with known tag
@@ -343,6 +345,9 @@ pub enum RawTaggedField {
 /// Tagged field with known tag
 ///
 /// For descriptions of the enum values please refer to the enclosed type's docs.
+///
+/// (C-not exported) As we don't yet support enum variants with the same name the struct contained
+/// in the variant.
 #[allow(missing_docs)]
 #[derive(Eq, PartialEq, Debug, Clone)]
 pub enum TaggedField {
@@ -1322,10 +1327,8 @@ impl std::error::Error for SemanticError { }
 
 /// When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
 /// may occur.
-///
-/// (C-not exported) As we don't support unbounded generics
 #[derive(Eq, PartialEq, Debug, Clone)]
-pub enum SignOrCreationError<S> {
+pub enum SignOrCreationError<S = ()> {
        /// An error occurred during signing
        SignError(S),
 
index 8f0ff31b904b78b42f4708ea3af8c4b7fd099a04..8811926782348a263735b55824ea74fb65d662cb 100644 (file)
@@ -2,7 +2,8 @@ use std::fmt;
 use std::fmt::{Display, Formatter};
 use bech32::{ToBase32, u5, WriteBase32, Base32Len};
 
-use ::*;
+use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
+       RouteHint, Description, RawTaggedField, Currency, RawHrp, SiPrefix, constants, SignedRawInvoice, RawDataPart};
 
 /// Converts a stream of bytes written to it to base32. On finalization the according padding will
 /// be applied. That means the results of writing two data blocks with one or two `BytesToBase32`
@@ -122,6 +123,7 @@ impl Display for SignedRawInvoice {
        }
 }
 
+/// (C-not exported)
 impl Display for RawHrp {
        fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
                let amount = match self.raw_amount {