1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//! # 🔮 Bronzite - Compile-time Type Reflection for Rust
//!
//! Bronzite provides powerful compile-time access to type information, trait implementations,
//! method bodies, and more. It enables proc-macros to introspect Rust code using a daemon
//! that leverages rustc internals.
//!
//! ## ✨ Quick Start
//!
//! ### High-Level Reflection API (Recommended)
//!
//! The v0.2 API provides an ergonomic, type-safe interface for exploring types:
//!
//! ```ignore
//! use bronzite_client::Crate;
//!
//! #[proc_macro]
//! pub fn my_macro(input: TokenStream) -> TokenStream {
//! // Connect to daemon and reflect on a crate
//! let krate = Crate::reflect("my_crate").unwrap();
//!
//! // Get a struct and explore it
//! let user = krate.get_struct("User").unwrap();
//!
//! // Navigate to fields
//! for field in user.fields().unwrap() {
//! println!("{}: {}", field.name.unwrap(), field.ty);
//!
//! // Navigate to field's type definition
//! if let Some(field_type) = field.type_def().unwrap() {
//! println!(" -> defined in: {}", field_type.path());
//! }
//! }
//!
//! // Check trait implementations
//! if user.implements("Debug").unwrap() {
//! println!("User implements Debug!");
//! }
//!
//! // Get methods
//! for method in user.methods().unwrap() {
//! println!("Method: {}", method.name);
//! if let Some(body) = &method.body_source {
//! println!(" Body: {}", body);
//! }
//! }
//!
//! // Generate code based on discoveries
//! quote! { /* ... */ }.into()
//! }
//! ```
//!
//! ### Pattern Matching
//!
//! Query types using intuitive glob patterns:
//!
//! ```ignore
//! use bronzite_client::Crate;
//!
//! let krate = Crate::reflect("my_crate")?;
//!
//! // Exact match
//! let user = krate.get_struct("User")?;
//!
//! // Single-level glob: matches "foo::Bar" but not "foo::bar::Baz"
//! let items = krate.items("mymod::*")?;
//!
//! // Recursive glob: matches all descendants
//! let all_items = krate.items("mymod::**")?;
//!
//! // Get only specific types
//! let structs = krate.structs("*")?;
//! let enums = krate.enums("*")?;
//! let traits = krate.traits("*")?;
//! ```
//!
//! ### Built-in Proc-Macros
//!
//! For simple use cases, use the built-in macros:
//!
//! ```ignore
//! use bronzite::bronzite_trait_names;
//!
//! // Get trait implementations as a const array
//! const USER_TRAITS: &[&str] = bronzite_trait_names!("my_crate", "User");
//! // Expands to: &["Debug", "Clone", "Serialize", ...]
//! ```
//!
//! ## 🏗️ Architecture
//!
//! Bronzite consists of several components working together:
//!
//! - **[`bronzite_client`]**: High-level reflection API and low-level RPC client
//! - **`bronzite-daemon`**: Background daemon that caches rustc compilation results
//! - **[`bronzite_macros`]**: Ready-to-use proc-macros for common reflection tasks
//! - **`bronzite-query`**: Rustc plugin that extracts type information
//! - **[`bronzite_types`]**: Shared types for the IPC protocol
//!
//! ## 📦 Installation
//!
//! Add to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! bronzite = "0.2"
//! bronzite-client = "0.2" # For proc-macro development
//! ```
//!
//! Install the daemon:
//!
//! ```bash
//! cargo install bronzite
//! rustup toolchain install nightly-2025-08-20
//! ```
//!
//! The daemon auto-starts when you use the reflection API.
//!
//! ## 🔍 API Overview
//!
//! ### Navigation Methods
//!
//! The high-level API allows fluent navigation between related types:
//!
//! - **Struct → Fields → Field Types**: `struct.fields()` → `field.type_def()`
//! - **Struct → Methods → Return Types**: `struct.methods()` → `method.return_type_def()`
//! - **Trait → Implementors**: `trait.implementors()`
//! - **Type Alias → Concrete Type**: `alias.resolve()`
//!
//! ### Type Information
//!
//! Access comprehensive type metadata:
//!
//! - Struct fields with types, visibility, and layout
//! - Enum variants with discriminants
//! - Trait methods with signatures and default implementations
//! - Method bodies as source code
//! - Generic parameters and where clauses
//! - Documentation comments
//!
//! ## 📚 Learn More
//!
//! - [High-level API documentation](bronzite_client::reflection)
//! - [Built-in macros](bronzite_macros)
//! - [GitHub Repository](https://github.com/drewridley/bronzite)
//!
//! ## 🎯 Use Cases
//!
//! - **Derive macro helpers**: Generate implementations based on field types
//! - **Validation**: Check trait bounds at compile time
//! - **Code generation**: Generate boilerplate based on type structure
//! - **Static analysis**: Analyze type relationships in proc-macros
//! - **Documentation tools**: Extract and process doc comments
// Re-export the high-level reflection API
pub use ;
// Re-export the low-level client for advanced use
pub use ;
// Re-export the built-in proc-macros
pub use ;
// Re-export common types for working with query results
pub use ;