API Reference
Complete API reference for Railgun's Rust crates.
Railgun is structured as a Cargo workspace with multiple crates.
Crate Overview
| Crate | Description | Primary Exports |
|---|---|---|
rg-types | Shared data structures | Config, Verdict, HookInput, ToolInput |
rg-policy | Policy engine | RuntimePolicy, inspect() |
Usage Example
Quick Links
- Types Reference — All data structures
- Policy Engine — Deep dive into inspection logic
- Configuration — Config file format
Error Handling
| Crate | Error Type | Description |
|---|---|---|
rg-types | — | No errors (pure data) |
rg-policy | PolicyError | Config parsing, pattern compilation |
bin/rg | eyre::Report | Top-level CLI error handling |
Example Error Handling
Thread Safety
All public types are designed for concurrent use:
RuntimePolicyisSend + SyncConfigisCloneVerdictisClone + Send
Minimum Supported Rust Version
Railgun requires Rust 1.75 or later.
Next Steps
- Types Reference — Detailed type documentation
- Configuration — Config file format
- Policy Engine — Inspection logic deep dive