Skip to main content

Crate tape_base64

Crate tape_base64 

Source
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::decode does
Encoder
An encode taken a piece at a time, giving what the pieces joined encode to

Enums§

DecodeError
Why a decode could not be completed
EncodeError
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 STANDARD encoding of len bytes takes