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//! - [`graph`] — directed graph containers, plus [`graph::analysis`] for
8//! dominator and post-dominator trees and canonical edge-based SESE
9//! (single-entry/single-exit) region decomposition.
10//! - [`stable_arena`] — an arena whose elements keep their address as it grows.
11//! - [`intern`] — string interning.
12//! - [`num_ref`] — small numeric reference helpers.
13//!
14//! Layered graph *layout* lives in the separate `wazabin-triskel` crate, which
15//! builds on [`graph`].
16
17extern crate self as jstd;
18
19/// Derive macro for strongly typed `usize` identifiers.
20///
21/// This derive is intended for tuple newtypes with exactly one `usize` field,
22/// and generates implementations for:
23/// - `Copy`, `Clone`, `Debug`, `Default`, `PartialEq`, `Eq`, `Hash`
24/// - `From<usize>` and `From<Self> for usize`
25/// - [`registry::Identifier`]
26///
27/// # Example
28/// ```
29/// use jstd::Identifier;
30///
31/// #[derive(Identifier)]
32/// pub struct MyId(usize);
33///
34/// let id = MyId::from(42usize);
35/// let raw: usize = id.into();
36/// assert_eq!(raw, 42);
37/// assert_eq!(MyId::default(), MyId::from(0usize));
38/// ```
39pub use jstd_derive::Identifier;
40
41pub mod graph;
42pub mod intern;
43pub mod log;
44pub mod num_ref;
45pub mod registry;
46pub mod stable_arena;