pub fn encode(data: &[u8], dictionary: &Dictionary) -> StringExpand description
Encodes binary data using the specified dictionary.
Automatically selects the appropriate encoding strategy based on the dictionary’s mode (Radix, Chunked, or ByteRange).
§Arguments
data- The binary data to encodedictionary- The dictionary to use for encoding
§Returns
A string containing the encoded data
§Examples
use base_d::{Dictionary, EncodingMode};
let chars: Vec<char> = "01".chars().collect();
let dictionary = Dictionary::builder()
.chars(chars)
.mode(EncodingMode::Radix)
.build()?;
let encoded = base_d::encode(b"Hi", &dictionary);