pub fn to_hex(bytes: &[u8], skip_leading_zero: bool) -> String {
	let bytes = if skip_leading_zero {
		let non_zero = bytes.iter().take_while(|b| **b == 0).count();
		let bytes = &bytes[non_zero..];
		if bytes.is_empty() {
			return "0x0".into()
		} else {
			bytes
		}
	} else if bytes.is_empty() {
		return "0x".into()
	} else {
		bytes
	};

	let mut slice = vec![0u8; (bytes.len() + 1) * 2];
	to_hex_raw(&mut slice, bytes, skip_leading_zero).into()
}
/// Serialize given bytes to a 0x-prefixed hex string.
///
/// If `skip_leading_zero` initial 0s will not be printed out,
/// unless the byte string is empty, in which case `0x0` will be returned.
/// The results are consistent with `serialize_uint` output if the flag is
/// on and `serialize_raw` if the flag is off.
Serialize given bytes to a 0x-prefixed hex string.
If `skip_leading_zero` initial 0s will not be printed out,
unless the byte string is empty, in which case `0x0` will be returned.
The results are consistent with `serialize_uint` output if the flag is
on and `serialize_raw` if the flag is off.
Serialize given bytes to a 0x - prefixed hex string . If ` skip_leading_zero ` initial 0s will not be printed out unless the byte string is empty in which case ` 0x0 ` will be returned . The results are consistent with ` serialize_uint ` output if the flag is on and ` serialize_raw ` if the flag is off .
pub fn to_hex(bytes: &[u8], skip_leading_zero: bool) -> String {
	let bytes = if skip_leading_zero {
		let non_zero = bytes.iter().take_while(|b| **b == 0).count();
		let bytes = &bytes[non_zero..];
		if bytes.is_empty() {
			return "0x0".into()
		} else {
			bytes
		}
	} else if bytes.is_empty() {
		return "0x".into()
	} else {
		bytes
	};
	let mut slice = vec![0u8; (bytes.len() + 1) * 2];
	to_hex_raw(&mut slice, bytes, skip_leading_zero).into()
}
pub fn to_hex ( bytes : & [ u8 ] , skip_leading_zero : bool ) -> String { let bytes = if skip_leading_zero { let non_zero = bytes . iter ( ) . take_while ( | b | * * b == 0 ) . count ( ) ; let bytes = & bytes [ non_zero .. ] ; if bytes . is_empty ( ) { return " " . into ( ) } else { bytes } } else if bytes . is_empty ( ) { return " " . into ( ) } else { bytes } ; let mut slice = vec ! [ 0u8 ( bytes len ( ) 1 ) 2 ] ; to_hex_raw ( & mut slice , bytes , skip_leading_zero ) . into ( ) }
Serialize given bytes to a 0x-prefixed hex string.
Serialize given bytes to a 0x - prefixed hex string .
bytes
&[u8]
skip_leading_zero
bool
bytes
&[u8]
skip_leading_zero
bool