Skip to main content

Module parcel

Module parcel 

Source
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::new and reuse across calls.
CodecBuildError
Errors raised when constructing a crate::parcel::Codec.
CodecConfig
Builder-style configuration for Codec; optional fields fall back to SPEC defaults.
DecodeExportError
Errors raised by decode_result_export.
DecodeMeta
Metadata returned alongside the decoded payload.
DecodedParcel
Decoded parcel: the recovered payload bytes plus envelope metadata.
EncodeExportError
Errors raised by encode_result_export.
ParcelError
Errors surfaced by the parcel codec on encode and decode (precedence per SPEC §6 / §6.1).
ResultExport
Top-level wowlab to addon export envelope (the inner JSON of a parcel).
ResultItem
A single exported item row, carrying enough identity to reconstruct a WoW item: link.

Enums§

ExportKind
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 export to JSON and wrap it in a parcel envelope as a single ASCII string.
result_export_codec
Build a codec preconfigured for wowlab result exports.