Skip to main content

Module types

Module types 

Source
Expand description

Core type system for BEAM — the Rust port of Gun.js.

This module defines the fundamental data types that flow through the distributed graph database:

  • Value — the five wire-compatible leaf types (null, bool, number, text, link)
  • NodeData — a leaf node’s payload (value + timestamp)
  • Children — a branch node’s sorted child map

§Gun.js Wire Compatibility

All types implement serde::Serialize / serde::Deserialize so they can be serialized to the JSON wire format that Gun.js uses. The Value::to_string method produces the Gun.js wire representation (not the std::fmt::Display representation).

§Value Validation

Valid values are a subset of JSON: null, boolean, number (finite, not NaN or Infinity), text, or a soul relation link. Arrays need special algorithms to handle concurrency and are not supported directly. Objects are valid only as node references: {"#": soul}.

§Example

use beam::types::{Value, NodeData};

let v = Value::Text("hello".into());
assert_eq!(v.to_string(), "hello");
assert_eq!(v.size(), 5);

let node = NodeData::default();
assert!(node.value.is_null());

Structs§

NodeData
Data stored in a leaf node of the graph.

Enums§

Value
Value types supported by BEAM and Gun.js.

Type Aliases§

Children
Branch node — a sorted map of child key to child data.