vtcode-macros
Procedural macros for VT Code.
vtcode-macros provides derive macros that eliminate boilerplate for common patterns in the VT Code codebase.
Derive macros
StringNewtype
Derive macro for tuple structs wrapping a single String field. Generates:
- Inherent methods:
new(),as_str(),into_inner() Deref<Target = str>Borrow<str>AsRef<str>DisplayFrom<String>,From<&str>,From<Self> for String
DebugNoInline
Derive macro equivalent to #[derive(Debug)], but the generated fmt is marked #[inline(never)]. Rust's built-in
Debug derive emits #[inline]; for large or deeply nested types formatted on fan-out paths, that can inline the
whole Debug tree into every {:?} / ?err call site and bloat the binary. Output is byte-identical to the standard
derive; only the inlining hint differs. Use it for large/nested types (often error enums); keep #[derive(Debug)] for
small, hot, leaf types. See docs/development/rust-performance-principles.md.
Usage
StringNewtype
use StringNewtype;
use ;
;
let id = new;
assert_eq!;
assert_eq!;
let inner: String = id.into_inner;
DebugNoInline
use DebugNoInline;
assert_eq!;