weakauras-codec-base64 0.1.0

Provides heavily optimized routines for decoding and encoding base64 used for WeakAuras-compatible strings.
Documentation
  • Coverage
  • 100%
    24 out of 24 items documented10 out of 14 items with examples
  • Size
  • Source code size: 122.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.14 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Zireael-N/weakauras-codec-rs
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Zireael-N

weakauras-codec-base64

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.

Decoding example

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(())
}

Encoding example

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(())
}

Crate features

  • std - Enable features that require the standard library. As of now, it's used only for runtime SIMD feature detection on x86_64 and x86 CPUs. Enabled by default.
  • alloc - Enable APIs that allocate, like decode_to_vec and encode_to_string. Enabled by default.