pub fn from_hex(v: &str) -> Result<Vec<u8>, FromHexError> {
	let (v, stripped) = v.strip_prefix("0x").map_or((v, false), |v| (v, true));

	let mut bytes = vec![0u8; (v.len() + 1) / 2];
	from_hex_raw(v, &mut bytes, stripped)?;
	Ok(bytes)
}
/// Decode given (both 0x-prefixed or not) hex string into a vector of bytes.
///
/// Returns an error if non-hex characters are present.
Decode given (both 0x-prefixed or not) hex string into a vector of bytes.
Returns an error if non-hex characters are present.
Decode given ( both 0x - prefixed or not ) hex string into a vector of bytes . Returns an error if non - hex characters are present .
pub fn from_hex(v: &str) -> Result<Vec<u8>, FromHexError> {
	let (v, stripped) = v.strip_prefix("0x").map_or((v, false), |v| (v, true));
	let mut bytes = vec![0u8; (v.len() + 1) / 2];
	from_hex_raw(v, &mut bytes, stripped)?;
	Ok(bytes)
}
pub fn from_hex ( v : & str ) -> Result < Vec < u8 > , FromHexError > { let ( v , stripped ) = v . strip_prefix ( " " ) . map_or ( ( v , false ) , | v | ( v , true ) ) ; let mut bytes = vec ! [ 0u8 ( v len ( ) 1 ) 2 ] ; from_hex_raw ( v , & mut bytes , stripped ) ? ; Ok ( bytes ) }
Decode given (both 0x-prefixed or not) hex string into a vector of bytes.
Decode given ( both 0x - prefixed or not ) hex string into a vector of bytes .
v
&str
v
&str