to_hex
fn to_hex(Vec<byte> buf) -> string Import
Source: use bytes::{to_hex}; src/bytes.hy Encodes buf as lowercase hexadecimal, two digits per byte.
Parameters#
| Name | Type |
|---|---|
buf | Vec<byte> |
Returns#
string
Contracts#
Checked according to --contracts (see Contracts).
ensures result.len() == 2 * buf.len()
Examples#
use bytes::{to_hex};
use tests::assert;
assert!(to_hex(Vec::from([0 as byte, 171 as byte, 255 as byte])) == "00abff");
See also#
region_eq: True whena[ao..ao+n)equalsb[bo..bo+n)(caller guarantees bounds).from_hex: Decodes hexadecimal text (either case) into bytes.slice: Returns a copy ofsrc[start..end](end exclusive), with both offsets clamped to the buffer.concat: Returns a new buffer holdingafollowed byb.eq: Returnstruewhenaandbhave the same length and the same bytes.find_from: Returns the offset of the firstneedleinhayat or afterstart, or-1.find: Returns the offset of the firstneedleinhay, or-1.rfind: Returns the offset of the lastneedleinhay, or-1.