Skip to main content

DebugAttr

Derive Macro DebugAttr 

Source
#[derive(DebugAttr)]
{
    // Attributes available to this derive:
    #[fmt]
    #[fmt_debug]
}
Expand description

Derive macro for implementing std::fmt::Debug.

§Attributes

  • #[fmt_debug("...", args...)] - Format string specifically for Debug (highest priority)
  • #[fmt("...", args...)] - Shared format string for both Display and Debug (fallback)

§Example

use format_attr::DebugAttr;

#[derive(DebugAttr)]
#[fmt_debug("User {{ name: {} }}", self.name)]
struct User {
    name: String,
}