Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::str::FromStr;
- use std::num::ParseIntError;
- #[derive(Debug)]
- struct BlockReference {
- multi_hash: String,
- }
- impl FromStr for BlockReference {
- type Err = ParseIntError;
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- Ok(BlockReference { multi_hash: s.to_string() })
- }
- }
- fn main() {
- let block_reference: BlockReference = "QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u".parse().unwrap();
- println!("{:?}", block_reference);
- }
Add Comment
Please, Sign In to add comment