Expand description
Value types and element identifiers for graph data.
This module provides the core data types used throughout Interstellar:
VertexId/EdgeId- Unique identifiers for graph elementsElementId- Union type for either vertex or edge IDsValue- Dynamic property value type (similar to JSON)ComparableValue- An ordered version ofValuefor sorting/dedup
§Value System
Interstellar uses a dynamic type system for property values, similar to JSON
but extended with graph-specific types for vertices and edges. The Value
enum can hold:
- Primitives:
Null,Bool,Int(i64),Float(f64),String - Collections:
List,Map - Graph references:
Vertex,Edge
§Type Conversions
Value implements From for common Rust types, making it easy to
construct values:
use interstellar::prelude::*;
let int_val: Value = 42i64.into();
let str_val: Value = "hello".into();
let bool_val: Value = true.into();
let float_val: Value = 3.14f64.into();§Serialization
Values can be serialized to and from a compact binary format using
Value::serialize and Value::deserialize, useful for persistence.
§Example
use interstellar::prelude::*;
use std::collections::HashMap;
// Create values from Rust types
let name: Value = "Alice".into();
let age: Value = 30i64.into();
// Check types
assert!(name.as_str().is_some());
assert!(age.as_i64().is_some());
// Work with vertex IDs
let vid = VertexId(42);
let vertex_val: Value = vid.into();
assert!(vertex_val.is_vertex());
assert_eq!(vertex_val.as_vertex_id(), Some(VertexId(42)));Structs§
- EdgeId
- A unique identifier for an edge in the graph.
- Ordered
Float - A floating-point wrapper that provides total ordering.
- Vertex
Id - A unique identifier for a vertex in the graph.
Enums§
- Comparable
Value - A comparable version of
Valuethat implementsOrd. - Element
Id - A union type representing either a vertex or edge identifier.
- Value
- A dynamic value type for graph properties and traversal results.
Traits§
- Into
Value Map - Helper trait for ergonomic conversion of map-like collections into a
ValueMapfor use withValue::Map. - Into
Vertex Id - Trait for types that can be converted to a VertexId.
Type Aliases§
- Value
Map - An order-preserving map type used for
Value::Mappayloads.