Module serialize

Module serialize 

Source
Expand description

Serialization of Seq Values

This module provides a serializable representation of Seq runtime values. It enables Value persistence and exchange with external systems.

§Use Cases

  • Actor persistence: Event sourcing and state snapshots
  • Data pipelines: Arrow/Parquet integration
  • IPC: Message passing between processes
  • Storage: Database and file persistence

§Why TypedValue?

The runtime Value type contains arena-allocated strings (SeqString) which aren’t directly serializable. TypedValue uses owned Strings and can be serialized with serde/bincode.

§Why BTreeMap instead of HashMap?

TypedValue::Map uses BTreeMap (not HashMap) for deterministic serialization. This ensures that the same logical map always serializes to identical bytes, which is important for:

  • Content-addressable storage (hashing serialized data)
  • Reproducible snapshots for testing and debugging
  • Consistent behavior across runs

The O(n log n) insertion overhead is acceptable since serialization is typically infrequent (snapshots, persistence) rather than on the hot path.

§Performance

Uses bincode for fast, compact binary serialization. For debugging, use TypedValue::to_debug_string().

Enums§

SerializeError
Error during serialization/deserialization
TypedMapKey
Serializable map key types
TypedValue
Serializable representation of Seq Values

Traits§

ValueSerialize
Extension trait for Value to add serialization methods