to_string
fn to_string(Vec<byte> b) -> Result<string, string> Import
Source: use bytes::{to_string}; src/bytes.hy Decodes b as UTF-8.
Parameters#
| Name | Type |
|---|---|
b | Vec<byte> |
Returns#
Result<string, string>
Errors#
Returns Err("utf8") when b is not valid UTF-8. string::from_bytes does
the same with an IoError.
See also#
string::from_bytesregion_eq: True whena[ao..ao+n)equalsb[bo..bo+n)(caller guarantees bounds).to_hex: Encodesbufas lowercase hexadecimal, two digits per byte.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.