| Crates.io | weakauras-codec |
| lib.rs | weakauras-codec |
| version | 0.1.1 |
| created_at | 2025-06-08 11:01:32.645573+00 |
| updated_at | 2025-09-25 15:49:02.516428+00 |
| description | Provides routines for decoding and encoding WeakAuras-compatible strings. |
| homepage | |
| repository | https://github.com/Zireael-N/weakauras-codec-rs |
| max_upload_size | |
| id | 1704791 |
| size | 29,972 |
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 feature. Disabled by default.rust-backend feature in flate2. Enabled by default.zlib-rs feature in flate2. Disabled by default.zlib feature in flate2. Disabled by default.zlib-ng feature in flate2. Disabled by default.zlib-ng-compat feature in flate2. Disabled by default.cloudflare_zlib feature in flate2. Disabled by default.arbitrary::Arbitrary for LuaValue. Disabled by default.fnv instead of BTreeMap as the implementation of LuaValue::Map. Disabled by default.indexmap instead of BTreeMap as the implementation of LuaValue::Map. Disabled by default.LuaValue using serde. Disabled by default.