inspect_core/lib.rs
1//! Core types and traits for the inspect-rs introspection system.
2//!
3//! This crate provides the fundamental [`Inspect`] trait and associated types
4//! for building structured introspection of Rust values without coupling to
5//! debuggers, serializers, or specific UI frameworks.
6//!
7//! # Overview
8//!
9//! The core model is:
10//!
11//! ```text
12//! Rust value
13//! ↓
14//! Inspect::inspect()
15//! ↓
16//! ValueRef (borrowed structured representation)
17//! ↓
18//! renderers / tooling / analysis
19//! ```
20//!
21//! # Design principles
22//!
23//! - **Lazy**: Values are not eagerly traversed
24//! - **Zero-copy**: Borrows from original values where possible
25//! - **Safe**: Handles cycles, respects limits, protects secrets
26//! - **Minimal**: Zero runtime dependencies
27//!
28//! # Example
29//!
30//! ```
31//! use inspect_core::{Inspect, InspectCx};
32//!
33//! let value = 42u32;
34//! let mut cx = InspectCx::new();
35//! let inspected = value.inspect(&mut cx);
36//!
37//! assert_eq!(inspected.kind().name(), "u32");
38//! ```
39
40#![cfg_attr(not(feature = "std"), no_std)]
41#![warn(missing_docs, missing_debug_implementations)]
42
43#[cfg(not(feature = "std"))]
44extern crate alloc;
45
46mod capability;
47mod context;
48mod error;
49mod field;
50mod inspect;
51mod kind;
52mod limit;
53mod path;
54mod sensitivity;
55mod type_info;
56mod value;
57mod variant;
58
59mod impls_primitives;
60mod impls_std;
61
62pub use capability::Capability;
63pub use context::{DepthGuard, InspectCx};
64pub use error::{InspectError, InspectResult};
65pub use field::FieldInfo;
66pub use inspect::Inspect;
67pub use kind::Kind;
68pub use limit::InspectLimits;
69pub use path::{InspectPath, PathSegment};
70pub use sensitivity::Sensitivity;
71pub use type_info::TypeInfo;
72pub use value::{Children, ValueRef};
73pub use variant::VariantInfo;