Guest User

Untitled

a guest
Jun 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. use std::str::FromStr;
  2.  
  3. use std::num::ParseIntError;
  4.  
  5. #[derive(Debug)]
  6. struct BlockReference {
  7. multi_hash: String,
  8. }
  9.  
  10. impl FromStr for BlockReference {
  11. type Err = ParseIntError;
  12.  
  13. fn from_str(s: &str) -> Result<Self, Self::Err> {
  14. Ok(BlockReference { multi_hash: s.to_string() })
  15. }
  16. }
  17.  
  18. fn main() {
  19. let block_reference: BlockReference = "QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u".parse().unwrap();
  20. println!("{:?}", block_reference);
  21. }
Add Comment
Please, Sign In to add comment