Expand description
Efficient and ergonomic representation of Wolfram expressions in Rust.
Modules§
- from_
wxf FromWXF— pull-based typed deserialization from aWxfReader.- symbol
- Representation of Wolfram Language symbols.
- to_wxf
ToWXF— per-Rust-type WXF encoder. Streams directly into aWxfWriter: compounds write a header then recurse into children. No intermediateVec, no&dyndispatch — fully monomorphized.- wxf
- WXF wire-format enums, re-exported from
wolfram_serialize, plus theArrayElementimpls that map Rust primitives to element-type tags.
Macros§
Structs§
- Array
Buf - Generic dense N-dimensional buffer parameterized by an element-type tag.
- BigInteger
- Wolfram Language
BigInteger— arbitrary-precision integer carried as its textual decimal representation (e.g."99999999999999999999999"). - BigReal
- Wolfram Language
BigReal— arbitrary-precision real carried as its WL textual representation, including any precision/accuracy markers (e.g."3.1415926535897932384650.“`). - Expr
- Wolfram Language expression.
- Normal
- Wolfram Language “normal” expression:
f[...]. - Rule
Entry - Single association entry — key, value, and a flag indicating
Rule(->, immediate) vsRuleDelayed(:>, held). - Symbol
- Wolfram Language symbol.
Enums§
- Compression
Level - zlib compression level passed to [
to_wxf]. - Expr
Kind - Wolfram Language expression variants.
- Expression
Enum - Top-level WXF expression token.
#[repr(u8)]discriminants are the wire bytes. - Header
Enum - WXF framing header bytes. No Display — header bytes overlap with some expression token bytes and are not used in error messages.
- Number
- Subset of
ExprKindthat covers number-type expression values. - Numeric
Array Enum - WXF element-type tag for NumericArray. Discriminants are the WXF wire bytes.
- Packed
Array Enum - WXF element-type tag for PackedArray. Same wire bytes as
NumericArrayEnumbut restricted to the packed-compatible variants (no unsigned integers).
Traits§
- Array
Element - Connects a Rust primitive to its element-type discriminant. Implemented
once per
(type, tag)pair: e.g.i32: ArrayElement<NumericArrayEnum>(withTAG = Integer32) andi32: ArrayElement<PackedArrayEnum>(withTAG = Integer32). Sealed — only the primitives in [sealed] above can satisfy theSealedsuper-bound. - FromWXF
- Deserialize a typed value by pulling tokens from a
WxfReader. - Numeric
Array Read - Common read API implemented by both the owned
crate::NumericArray/crate::PackedArrayand the runtime-handleNumericArray<T>inwolfram-library-link. - Reader
- Raw byte source that lends buffer-lifetime views.
'deis the lifetime of the underlying buffer. Reads consume forward; there is no rewind, no peek. - ToWXF
- Types that know how to serialize themselves into a WXF stream.
Functions§
- from_
wxf - Deserialize
bytes(WXF;8:or8C:auto-detected) into a typedT. - from_
wxf_ ref - Deserialize
bytesinto a borrowedTwhose&str/&[u8]fields point straight intobytes(zero-copy). The result borrowsbytes, so the input must be uncompressed (8:) — a8C:payload would have to be decompressed into a temporary the borrow couldn’t outlive (use [from_wxf] for the owned form, orread_wxfto borrow within a closure). - read_
wxf - Read from a WXF blob (
8:/8C:auto-detected) via aWxfReader. The closure can pull one or more top-level values — e.g. aFunction[List, …]wrapper around several arguments. For a single value, prefer [from_wxf]. - to_wxf
- Serialize
valueto WXF.
Type Aliases§
- Association
- Wolfram Language
<|...|>— an ordered list ofRuleEntry. - Byte
Array - Owned byte buffer — Wolfram Language
ByteArray["..."]. - Complex32
- Single 32-bit complex number — pair of
f32(real, imaginary). Layout matches the WXFComplexReal32element wire format. No_Complex floattypedef exists inWolframLibrary.h, so this type is wolfram-expr-only. - Complex64
- Single 64-bit complex number — pair of
f64(real, imaginary). - F32
- 32-bit floating-point real number. Not NaN.
- F64
- 64-bit floating-point real number. Not NaN.
- Numeric
Array - Portable, owned
NumericArrayWL value. - Packed
Array - Owned
PackedArrayWL value.