Expand description
Base64 encoding and decoding
One kernel per architecture. Every conversion writes into a caller’s
buffer, nothing allocates, and the crate is no_std.
let mut encoded = [0u8; 8];
let written = tape_base64::encode(b"hello", &mut encoded).unwrap();
assert_eq!(&encoded[..written], b"aGVsbG8=");
let mut decoded = [0u8; 5];
let written = tape_base64::decode(b"aGVsbG8=", &mut decoded).unwrap();
assert_eq!(&decoded[..written], b"hello");Structs§
- Codec
- An alphabet and a padding rule
- Decoder
- A decode taken a piece at a time, reading and refusing where
Codec::decodedoes - Encoder
- An encode taken a piece at a time, giving what the pieces joined encode to
Enums§
- Decode
Error - Why a decode could not be completed
- Encode
Error - Why an encode could not be written
Constants§
- STANDARD
- RFC 4648 section 4: the alphabet ending
+/, padded with= - STANDARD_
NO_ PAD - RFC 4648 section 4 without padding, where
=is refused like any byte - URL_
SAFE - RFC 4648 section 5: the alphabet ending
-_, with padding - URL_
SAFE_ NO_ PAD - RFC 4648 section 5 without padding
Functions§
- decode
- Decode with
STANDARD, returning how many bytes were written - encode
- Encode with
STANDARD, returning how many characters were written - encoded_
len - Characters the
STANDARDencoding oflenbytes takes