Crates.io | weakauras-codec-base64 |
lib.rs | weakauras-codec-base64 |
version | 0.1.0 |
created_at | 2025-06-08 10:43:07.078563+00 |
updated_at | 2025-06-08 10:43:07.078563+00 |
description | Provides heavily optimized routines for decoding and encoding base64 used for WeakAuras-compatible strings. |
homepage | |
repository | https://github.com/Zireael-N/weakauras-codec-rs |
max_upload_size | |
id | 1704764 |
size | 123,511 |
This library provides heavily optimized routines for decoding and encoding base64 used for WeakAuras-compatible strings.
Why does this library exist? Base64 used in WeakAuras packs bits in a non-standard way, this makes it impossible to use existing implementations, even if they do support custom alphabets.
This is how you can use the library to decode base64-encoded data.
use weakauras_codec_base64::{DecodeError, decode_to_vec};
fn main() -> Result<(), DecodeError> {
assert_eq!(decode_to_vec(b"ivgBS9glGC3BYXgzHa")?, b"Hello, world!");
Ok(())
}
This is how you can use the library to encode data as base64.
use weakauras_codec_base64::{EncodeError, encode_to_string};
fn main() -> Result<(), EncodeError> {
assert_eq!(encode_to_string(b"Hello, world!")?, "ivgBS9glGC3BYXgzHa");
Ok(())
}
decode_to_vec
and encode_to_string
. Enabled by default.