Skip to content

Commit

Permalink
fix no-std final
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Sep 15, 2023
1 parent ea98b3c commit 7a1fe8f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions primitives/core/src/bip340.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl serde::Serialize for Bip340 {
where
S: serde::Serializer,
{
#[cfg(not(feature = "std"))]
use codec::alloc::string::ToString;
serializer.serialize_str(&self.to_string())
}
Expand All @@ -122,9 +123,10 @@ impl<'de> serde::Deserialize<'de> for Bip340 {
where
D: serde::Deserializer<'de>,
{
use codec::alloc::string::{String, ToString};
#[cfg(not(feature = "std"))]
use codec::alloc::string::String;
sp_std::str::FromStr::from_str(&String::deserialize(deserializer)?)
.map_err(|e| serde::de::Error::custom(e.to_string()))
.map_err(|e| serde::de::Error::custom(e))
}
}

Expand Down

0 comments on commit 7a1fe8f

Please sign in to comment.