Struct Trie Envelope

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub struct TrieEnvelope {
    pub version: String,
    pub generated_at: String,
    pub workflow_name: String,
    pub root: PredictionTrieNode,
}

Versioned envelope wrapping a prediction trie for JSON persistence.

Wire format matches NAT’s serialization.py:

1{
2 "version": "1.0",
3 "generated_at": "2026-03-31T12:00:00+00:00",
4 "workflow_name": "my_agent",
5 "root": { ... PredictionTrieNode ... }
6}

Fields

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

impl TrieEnvelope

new

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

Create a new envelope with the current timestamp and version.

to_json

pub fn to_json(&self) -> Result<String, Error>

Serialize to a JSON string.

from_json

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

Deserialize from a JSON string.

Trait Implementations

impl Clone for TrieEnvelope

impl Clone for TrieEnvelope

clone

fn clone(&self) -> TrieEnvelope

clone_from

fn clone_from(&mut self, source: &Self)

impl Debug for TrieEnvelope

impl Debug for TrieEnvelope

fmt

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'de> Deserialize<'de> for TrieEnvelope

impl<'de> Deserialize<'de> for TrieEnvelope

deserialize

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,

impl Serialize for TrieEnvelope

impl Serialize for TrieEnvelope

serialize

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where
    __S: Serializer,