jstd/lib.rs
1//! Small, reusable Rust building blocks, extracted from a binary-analysis
2//! toolchain and kept dependency-light.
3//!
4//! - [`registry`] — strongly typed `usize` identifiers ([`Identifier`]) and
5//! id-indexed registries, so a `NodeId` cannot be passed where an `EdgeId`
6//! belongs.
7//! - [`recycling_arena`] — typed slab storage that reuses removed slots.
8//! - [`graph`] — directed graph containers, plus [`graph::analysis`] for
9//! dominator and post-dominator trees and canonical edge-based SESE
10//! (single-entry/single-exit) region decomposition.
11//! - [`stable_arena`] — an arena whose elements keep their address as it grows.
12//! - [`intern`] — string interning.
13//! - [`num_ref`] — small numeric reference helpers.
14//!
15//! Layered graph *layout* lives in the separate `wazabin-triskel` crate, which
16//! builds on [`graph`].
17
18extern crate self as jstd;
19
20/// Derive macro for strongly typed `usize` identifiers.
21///
22/// This derive is intended for tuple newtypes with exactly one `usize` field,
23/// and generates implementations for:
24/// - `Copy`, `Clone`, `Debug`, `Default`, `PartialEq`, `Eq`, `Hash`
25/// - `From<usize>` and `From<Self> for usize`
26/// - [`registry::Identifier`]
27///
28/// # Example
29/// ```
30/// use jstd::Identifier;
31///
32/// #[derive(Identifier)]
33/// pub struct MyId(usize);
34///
35/// let id = MyId::from(42usize);
36/// let raw: usize = id.into();
37/// assert_eq!(raw, 42);
38/// assert_eq!(MyId::default(), MyId::from(0usize));
39/// ```
40pub use jstd_derive::Identifier;
41
42pub mod graph;
43pub mod intern;
44pub mod log;
45pub mod num_ref;
46pub mod recycling_arena;
47pub mod registry;
48pub mod stable_arena;