fn parse_input(&self, input: String) -> Result<Hash, Error> {
		if let Ok(height) = input.parse() {
			match self.chain.clone().get_header_by_height(height) {
				Ok(header) => return Ok(header.hash()),
				Err(_) => return Err(Error::NotFound),
			}
		}
		lazy_static! {
			static ref RE: Regex = Regex::new(r"[0-9a-fA-F]{64}").unwrap();
		}
		if !RE.is_match(&input) {
			return Err(Error::Argument(
					String::from("Not a valid hash or height.")))
		}
		let vec = util::from_hex(input).unwrap();
		Ok(Hash::from_vec(vec))
	}
// Try to decode the string as a height or a hash.
Try to decode the string as a height or a hash.
Try to decode the string as a height or a hash .
fn parse_input(&self, input: String) -> Result<Hash, Error> {
		if let Ok(height) = input.parse() {
			match self.chain.clone().get_header_by_height(height) {
				Ok(header) => return Ok(header.hash()),
				Err(_) => return Err(Error::NotFound),
			}
		}
		lazy_static! {
			static ref RE: Regex = Regex::new(r"[0-9a-fA-F]{64}").unwrap();
		}
		if !RE.is_match(&input) {
			return Err(Error::Argument(
					String::from("Not a valid hash or height.")))
		}
		let vec = util::from_hex(input).unwrap();
		Ok(Hash::from_vec(vec))
	}
fn parse_input ( & self , input : String ) -> Result < Hash , Error > { if let Ok ( height ) = input . parse ( ) { match self . chain . clone ( ) . get_header_by_height ( height ) { Ok ( header ) => return Ok ( header . hash ( ) ) , Err ( _ ) => return Err ( Error :: NotFound ) , } } lazy_static ! { static ref RE Regex Regex new ( r"[0-9a-fA-F]{64}" ) unwrap ( ) } if ! RE . is_match ( & input ) { return Err ( Error :: Argument ( String :: from ( " " ) ) ) } let vec = util :: from_hex ( input ) . unwrap ( ) ; Ok ( Hash :: from_vec ( vec ) ) }
Try to decode the string as a height or a hash.
Try to decode the string as a height or a hash .
&self
input
String