Skip to content

Commit

Permalink
add missing serde feature cfg attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbus committed Mar 12, 2024
1 parent 1c8feb9 commit 0d60028
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ serde_crate = { workspace = true, optional = true }
serde_yaml = { workspace = true, optional = true }
serde_with = { workspace = true, optional = true }
log = { workspace = true, optional = true }
cfg_eval = "0.1.2"

[features]
default = ["esplora_blocking"]
Expand Down
18 changes: 9 additions & 9 deletions src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub trait DescriptorRgb<K = XpubDerivable, V = ()>: Descriptor<K, V> {
}

#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
#[derive(Serialize, Deserialize)]
#[serde(crate = "serde_crate", rename_all = "camelCase")]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "serde_crate", rename_all = "camelCase"))]
#[repr(u8)]
pub enum RgbKeychain {
#[display("0", alt = "0")]
Expand Down Expand Up @@ -106,15 +106,15 @@ impl From<RgbKeychain> for Keychain {
fn from(keychain: RgbKeychain) -> Self { Keychain::from(keychain as u8) }
}

#[serde_as]
#[cfg_attr(feature = "serde", cfg_eval::cfg_eval, serde_as)]
#[derive(Clone, Eq, PartialEq, Debug)]
#[derive(Serialize, Deserialize)]
#[serde(crate = "serde_crate", rename_all = "camelCase")]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "serde_crate", rename_all = "camelCase"))]
pub struct TapretKey<K: DeriveXOnly = XpubDerivable> {
pub internal_key: K,
// TODO: Allow multiple tweaks per index by introducing derivation using new Terminal trait
// TODO: Change serde implementation for both Terminal and TapretCommitment
#[serde_as(as = "HashMap<serde_with::DisplayFromStr, serde_with::DisplayFromStr>")]
#[cfg_attr(feature = "serde", serde_as(as = "HashMap<serde_with::DisplayFromStr, serde_with::DisplayFromStr>"))]
pub tweaks: HashMap<Terminal, TapretCommitment>,
}

Expand Down Expand Up @@ -224,15 +224,15 @@ impl<K: DeriveXOnly> DescriptorRgb<K> for TapretKey<K> {
}

#[derive(Clone, Eq, PartialEq, Debug, From)]
#[derive(Serialize, Deserialize)]
#[serde(
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(
crate = "serde_crate",
rename_all = "camelCase",
bound(
serialize = "S::Compr: serde::Serialize, S::XOnly: serde::Serialize",
deserialize = "S::Compr: serde::Deserialize<'de>, S::XOnly: serde::Deserialize<'de>"
)
)]
))]
#[non_exhaustive]
pub enum RgbDescr<S: DeriveSet = XpubDerivable> {
#[from]
Expand Down
7 changes: 6 additions & 1 deletion src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
use std::collections::HashMap;
use std::convert::Infallible;
use std::io;
#[cfg(feature = "serde")]
use std::io::ErrorKind;
use std::ops::{Deref, DerefMut};
use std::path::PathBuf;

use amplify::IoError;
use bpstd::{Network, XpubDerivable};
use bpwallet::Wallet;
#[cfg(feature = "serde")]
use rgbfs::StockFs;
use rgbstd::containers::{Contract, LoadError, Transfer};
use rgbstd::interface::{
Expand All @@ -43,7 +45,9 @@ use rgbstd::persistence::{
use rgbstd::resolvers::ResolveHeight;
use rgbstd::validation::{self, ResolveWitness};
use rgbstd::{AssignmentWitness, ContractId, WitnessId, XChain, XOutpoint};
use strict_types::encoding::{DecodeError, DeserializeError, Ident, SerializeError, TypeName};
use strict_types::encoding::{DeserializeError, Ident, SerializeError, TypeName};
#[cfg(feature = "serde")]
use strict_types::encoding::DecodeError;

use crate::{DescriptorRgb, RgbDescr};

Expand Down Expand Up @@ -109,6 +113,7 @@ pub enum RuntimeError {
#[from]
Esplora(esplora::Error),

#[cfg(feature = "serde")]
#[from]
Yaml(serde_yaml::Error),

Expand Down

0 comments on commit 0d60028

Please sign in to comment.