[][src]Crate boba

The Bubble Babble binary data encoding.

This is a native Rust implementation of a Bubble Babble encoder and decoder.


You can encode binary data by calling encode:

let enc = boba::encode("Pineapple");
assert_eq!(enc, "xigak-nyryk-humil-bosek-sonax");

Decoding binary data is done by calling decode:

let dec = boba::decode("xexax")?;
assert_eq!(dec, vec![]);

Decode is fallible and can return DecodeError. For example, all Bubble Babble-encoded data has an ASCII alphabet, so attempting to decode an emoji will fail.

let dec = boba::decode("x🦀x");
// The `DecodeError` contains the offset of the first invalid byte.
assert_eq!(Err(DecodeError::InvalidByte(1)), dec);


This crate operates on byte slices, but encode returns a String. This crate contains a single line of unsafe code to turn the encode buffer into a String. This is known to be safe since the buffer is populated from a fixed, ASCII-only alpahabet.



Decoding errors from boba::decode.



Decode Bubble Babble-encoded byte slice to a Vec<u8>.


Encode a byte slice with the Bubble Babble encoding to a String.