aimdb-derive
Derive macros for AimDB record key types.
Overview
This crate provides the #[derive(RecordKey)] macro for defining compile-time
checked record keys in AimDB. This is especially useful for embedded systems
where typos in string keys would cause runtime failures.
Usage
use RecordKey;
// Now use in AimDB:
let producer = db.;
Attributes
#[key = "..."] (required on variants)
Specifies the string key for a variant. This is the value returned by as_str().
#[key_prefix = "..."] (optional on enum)
Prepends a prefix to all variant keys:
Generated Code
The macro generates:
impl RecordKey for YourEnumwithas_str()methodimpl Borrow<str> for YourEnumfor O(1) HashMap lookups
no_std Support
This crate is fully no_std compatible. The generated code uses only
core::borrow::Borrow, not std::borrow::Borrow.
License
Apache-2.0