Expand description
LibParcel-1.0 wire-format codec; Rust counterpart of the pure-Lua packages/LibParcel-1.0/.
use wowlab_parsers::parcel::{Codec, CodecConfig};
let codec = Codec::new(CodecConfig {
prefix: "!DEMO:1!".into(),
content_types: vec!["json".into()],
default_content_type: None,
max_encoded_len: None,
max_decoded_body: None,
max_payload_bytes: None,
}).expect("static config");
let encoded = codec.encode(b"{\"hello\":1}", None).unwrap();
let decoded = codec.decode(&encoded).unwrap();
assert_eq!(decoded.payload, b"{\"hello\":1}");Structs§
- Codec
- Validated parcel codec; construct with
Codec::newand reuse across calls. - Codec
Build Error - Errors raised when constructing a
crate::parcel::Codec. - Codec
Config - Builder-style configuration for
Codec; optional fields fall back to SPEC defaults. - Decode
Export Error - Errors raised by
decode_result_export. - Decode
Meta - Metadata returned alongside the decoded payload.
- Decoded
Parcel - Decoded parcel: the recovered payload bytes plus envelope metadata.
- Encode
Export Error - Errors raised by
encode_result_export. - Parcel
Error - Errors surfaced by the parcel codec on encode and decode (precedence per SPEC §6 / §6.1).
- Result
Export - Top-level wowlab to addon export envelope (the inner JSON of a parcel).
- Result
Item - A single exported item row, carrying enough identity to reconstruct a
WoWitem:link.
Enums§
- Export
Kind - What kind of result is being exported.
Constants§
- DEFAULT_
MAX_ DECODED_ BODY - Default cap on the size of the base64-decoded body.
- DEFAULT_
MAX_ ENCODED_ LEN - Default cap on the total length of the encoded string.
- DEFAULT_
MAX_ PAYLOAD_ BYTES - Default cap on the size of the raw payload after inflate.
- RESULT_
EXPORT_ CONTENT_ TYPE - Content-type token used inside the envelope.
- RESULT_
EXPORT_ PREFIX - Wire-format prefix for the result export envelope; trailing digit is the version.
- RESULT_
EXPORT_ SCHEMA_ VERSION - Schema version embedded in the JSON payload, distinct from the wire prefix version.
Functions§
- decode_
result_ export - Inverse of
encode_result_export. - encode_
result_ export - Serialise
exportto JSON and wrap it in a parcel envelope as a single ASCII string. - result_
export_ codec - Build a codec preconfigured for wowlab result exports.