Liaise
Liaise is a no_std diagnostic framework that enforces unique error identities at compile-time. It provides a bridge (a "liaison") between your internal error enums and professional, grep-able diagnostic reporting.
Why Liaise?
- Introspection & Validation: Automatically extracts variant IDs and ensures no two variants share the same ID.
- Zero-Runtime Cost: All validation happens during compilation via a "Sentinel" check. If your IDs aren't unique, the code won't build.
- Enterprise Standards: Standardizes error reporting into the
[PREFIX0000]format used by professional toolchains. - Proc-macro Ready: Includes built-in adapters for
synandproc-macro2for high-quality compiler error reporting.
Quick Start
1. Define and Register
Use #[derive(RegisterErrors)] to turn a standard enum into a validated Registry.
use ;
// Sets the reporting prefix
2. Batch Reporting (with syn)
If you're writing a procedural macro, use the DiagBuffer to collect errors and report them all at once.
use ;
The Architecture
Liaise splits diagnostic concerns into three layers to maintain no_std purity and modularity:
| Layer | Responsibility | Mechanism |
|---|---|---|
ErrorRegistry |
Identity/DNA | Stores static metadata (IDs, Prefix) and validates uniqueness. |
Liaise |
Behavior/Voice | Defines rendering logic and human-readable messages. |
Adapters |
Bridge | Connects the system to external crates like syn. |
Features
syn-error: Enables theSynBufferand helper extensions forsyn.
Pro-Tip: Stability is Key
Liaise is designed for systems where error codes are permanent. By assigning an explicit u16 to every variant, you ensure that even if you rename the variant in your source code, the error ID remains stable for your users, documentation, and support teams.