vtcode-macros 0.123.4

Procedural macros for VT Code
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 7.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 283.88 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vinhnx

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>
  • Display
  • From<String>, From<&str>, From<Self> for String

Usage

use vtcode_macros::StringNewtype;
use serde::{Serialize, Deserialize};

#[derive(Debug, Clone, Serialize, Deserialize, StringNewtype)]
#[serde(transparent)]
pub struct SessionId(String);

let id = SessionId::new("abc-123");
assert_eq!(id.as_str(), "abc-123");
assert_eq!(id.to_string(), "abc-123");

let inner: String = id.into_inner();

API reference

See docs.rs/vtcode-macros.