shape-runtime 0.2.0

Bytecode compiler, builtins, and runtime infrastructure for Shape
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Core serialization trait for binary encoding/decoding.
// Types implementing Serializable can be converted to/from byte arrays,
// enabling snapshot persistence, wire transfer, and distributed computing.

/// Convert values to and from a stable byte representation.
trait Serializable {
    /// Serialize self value to a byte array
    to_bytes(self): Vec<byte>

    /// Deserialize a value from a byte array
    from_bytes(bytes: Vec<byte>): Self
}

// Builtin implementations are registered in Rust (registry.rs)
// for: number, string, bool, Vec<T> where T: Serializable