std::encoding
Std::base64 and std::hex: bytes as text and back. Each result goes in the allocator passed (or the default one).
Source: std/encoding.volt
Types
error std::base64::decode_error
error decode_errorwhy decoding failed
| Variant | |
|---|---|
BAD_INPUT | a character that isn't in the alphabet, a wrong length, or misplaced padding |
error std::hex::decode_error
error decode_errorwhy decoding failed
| Variant | |
|---|---|
BAD_INPUT | an odd length, or a character that isn't a hex digit |
Functions
std::base64::encode
<A: std::mem::allocator = std::mem::default_allocator> fn encode(data: u8[..], allocator: A = {}) -> std::string<A>data in base64 (RFC 4648), with = padding
std::base64::encode
<A: std::mem::allocator = std::mem::default_allocator> fn encode(text: str, allocator: A = {}) -> std::string<A>std::base64::encode_url
<A: std::mem::allocator = std::mem::default_allocator> fn encode_url(data: u8[..], allocator: A = {}) -> std::string<A>data in the URL- and file-name-safe alphabet (- and _ for + and /), without padding
std::base64::encode_url
<A: std::mem::allocator = std::mem::default_allocator> fn encode_url(text: str, allocator: A = {}) -> std::string<A>std::base64::decode
<A: std::mem::allocator = std::mem::default_allocator> fn decode(text: str, allocator: A = {}) -> decode_error!std::vec<u8, A>the bytes that base64 text (with its = padding) stands for
std::base64::decode_url
<A: std::mem::allocator = std::mem::default_allocator> fn decode_url(text: str, allocator: A = {}) -> decode_error!std::vec<u8, A>the bytes that URL-safe base64 text stands for, padded or not
std::hex::encode
<A: std::mem::allocator = std::mem::default_allocator> fn encode(data: u8[..], allocator: A = {}) -> std::string<A>each byte of data as two lower-case hex digits
std::hex::encode
<A: std::mem::allocator = std::mem::default_allocator> fn encode(text: str, allocator: A = {}) -> std::string<A>std::hex::decode
<A: std::mem::allocator = std::mem::default_allocator> fn decode(text: str, allocator: A = {}) -> decode_error!std::vec<u8, A>the bytes hex digits (either case) stand for