zerodds_ast_core/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3//! Crate `zerodds-ast-core`. Safety classification: **SAFE**.
4//!
5//! Generic infrastructure for the common AST: generational arenas with
6//! typed handles, stable node identity, three-valued references,
7//! undo-logged transactions with changeset emission, observers,
8//! cycle-safe traversal, incremental indices and a deterministic
9//! snapshot codec.
10//!
11//! This crate knows nothing about DDS, IDL or wire formats. The model
12//! itself lives in `zerodds-ast`, wire layout in `zerodds-ast-layout`.
13//!
14//! ## Spec
15//!
16//! - `docs/specs/zerodds-ast-1.0.md` §1 (storage and identity),
17//! §2 (references), §5 (transactions and events), §6 (traversal),
18//! §9 (snapshot), §10 (error model).
19//!
20//! ## Layer position
21//!
22//! Layer 0 — no dependencies. Direct dependents: `zerodds-ast`,
23//! `zerodds-ast-layout`.
24#![no_std]
25#![forbid(unsafe_code)]
26
27extern crate alloc;
28
29// The unit-test harness itself needs std; the crate does not.
30#[cfg(test)]
31extern crate std;
32
33pub mod arena;
34pub mod change;
35pub mod error;
36pub mod id;
37pub mod index;
38pub mod observer;
39pub mod reference;
40pub mod snapshot;
41pub mod txn;
42pub mod walk;
43
44pub use arena::{Arena, Id};
45pub use change::{Change, Changeset, FieldTag, FieldValue, NodeKindTag, RefState};
46pub use error::AstCoreError;
47pub use id::{IdAllocator, IdSpace, NodeId};
48pub use index::{Index, IndexLookup};
49pub use observer::{AstObserver, ObserverRegistry, ObserverToken};
50pub use reference::{
51 BreakCause, PendingRef, Ref, RepositoryId, RosInterfaceKind, RosTypeName, ScopedName,
52 TypeIdentifierKey, XmlRefKey,
53};
54pub use snapshot::{SNAPSHOT_MAGIC, SNAPSHOT_VERSION, SnapshotReader, SnapshotWriter};
55pub use txn::{TxnLog, UndoPayload, UndoRecord, Undoable};
56pub use walk::{VisitSet, WalkOrder, reachable, walk_graph};