This library provides routines for decoding and encoding WeakAuras-compatible strings.
This is how you can use the library to decode WeakAuras-compatible strings.
use weakauras_codec::{DecodeError, decode};
fn main() -> Result<(), DecodeError> {
let expected_value = "Hello, world!".into();
assert_eq!(
decode(b"!lodJlypsnNCYxN6sO88lkNuumU4aaa", None)?.unwrap(),
expected_value
);
assert_eq!(
decode(b"!WA:2!JXl5rQ5Kt(6Oq55xuoPOiaa", Some(1024))?.unwrap(),
expected_value
);
Ok(())
}This is how you can use the library to encode data as a WeakAuras-compatible string.
use std::error::Error;
use weakauras_codec::{OutputStringVersion, decode, encode};
fn main() -> Result<(), Box<dyn Error>> {
let value = "Hello, world!".into();
let encoded_value_1 = encode(&value, OutputStringVersion::Deflate)?;
let encoded_value_2 = encode(&value, OutputStringVersion::BinarySerialization)?;
assert_eq!(decode(encoded_value_1.as_bytes(), None)?.unwrap(), value);
assert_eq!(decode(encoded_value_2.as_bytes(), None)?.unwrap(), value);
Ok(())
}- legacy-strings-decoding - Enable decoding of legacy WeakAuras-compatible strings. Uses a GPL-licensed library. Disabled by default.
- gpl-dependencies - Enable GPL-licensed dependencies. Currently, it enables the
legacy-strings-decodingfeature. Disabled by default. - flate2-rust-backend - Enable the
rust-backendfeature inflate2. Enabled by default. - flate2-zlib-rs - Enable the
zlib-rsfeature inflate2. Disabled by default. - flate2-zlib - Enable the
zlibfeature inflate2. Disabled by default. - flate2-zlib-ng - Enable the
zlib-ngfeature inflate2. Disabled by default. - flate2-zlib-ng-compat - Enable the
zlib-ng-compatfeature inflate2. Disabled by default. - flate2-cloudflare-zlib - Enable the
cloudflare_zlibfeature inflate2. Disabled by default. - lua-value-arbitrary - Implement
arbitrary::ArbitraryforLuaValue. Disabled by default. - lua-value-fnv - Use
fnvinstead ofBTreeMapas the implementation ofLuaValue::Map. Disabled by default. - lua-value-indexmap - Use
indexmapinstead ofBTreeMapas the implementation ofLuaValue::Map. Disabled by default. - serde - Allow serializing and deserializing
LuaValueusingserde. Disabled by default.