mod serialization#

module serialization#

NAT wire-format serialization for prediction tries.

Variables

const CURRENT_VERSION: &str#

Version string for the trie wire format.

Structs and Unions

struct TrieEnvelope#

Versioned envelope wrapping a prediction trie for JSON persistence.

Wire format matches NAT’s serialization.py:

{
  "version": "1.0",
  "generated_at": "2026-03-31T12:00:00+00:00",
  "workflow_name": "my_agent",
  "root": { ... PredictionTrieNode ... }
}
version: String#

Wire-format version string.

generated_at: String#

RFC 3339 timestamp indicating when the envelope was generated.

workflow_name: String#

Workflow or agent name associated with the trie.

root: PredictionTrieNode#

Root trie node.

Implementations

impl TrieEnvelope#

Functions

fn from_json(json: &str) -> Result<Self, serde_json::Error>#

Deserialize from a JSON string.

fn new(root: PredictionTrieNode, workflow_name: impl Into<String>) -> Self#

Create a new envelope with the current timestamp and version.

fn to_json(&self) -> Result<String, serde_json::Error>#

Serialize to a JSON string.