Skip to content

Commit b5d25f8

Browse files
committed
Implement FromStr for AssetId
1 parent 5d826e8 commit b5d25f8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/issuance.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
//! Asset Issuance
1616
17+
use std::str::FromStr;
18+
1719
use bitcoin::util::hash::BitcoinHash;
1820
use bitcoin::hashes::{hex, sha256, Hash};
1921
use fast_merkle_root::fast_merkle_root;
@@ -110,6 +112,13 @@ impl ::std::fmt::LowerHex for AssetId {
110112
}
111113
}
112114

115+
impl FromStr for AssetId {
116+
type Err = hex::Error;
117+
fn from_str(s: &str) -> Result<Self, Self::Err> {
118+
hex::FromHex::from_hex(s)
119+
}
120+
}
121+
113122
#[cfg(feature = "serde")]
114123
impl ::serde::Serialize for AssetId {
115124
fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {

0 commit comments

Comments
 (0)