Skip to main content

Crate standout_macros

Crate standout_macros 

Source
Expand description

Proc macros for Standout.

This crate provides macros for compile-time resource embedding and declarative command dispatch configuration.

§Available Macros

§Embedding Macros

§Derive Macros

  • Dispatch - Generate dispatch configuration from clap Subcommand enums
  • Tabular - Generate TabularSpec from struct field annotations
  • TabularRow - Generate optimized row extraction without JSON serialization
  • Seekable - Generate query-enabled accessor functions for Seeker

§Attribute Macros

  • [handler] - Transform pure functions into Standout-compatible handlers

§Design Philosophy

These macros return EmbeddedSource types that contain:

  1. Embedded content (baked into binary at compile time)
  2. Source path (for debug hot-reload)

This design enables:

  • Release builds: Use embedded content, zero file I/O
  • Debug builds: Hot-reload from disk if source path exists

§Examples

For working examples, see:

  • standout/tests/embed_macros.rs - embedding macros
  • standout/tests/dispatch_derive.rs - dispatch derive macro

Macros§

embed_styles
Embeds all stylesheet files from a directory at compile time.
embed_templates
Embeds all template files from a directory at compile time.

Attribute Macros§

handler
Transforms a pure function into a Standout-compatible handler.

Derive Macros§

Dispatch
Derives dispatch configuration from a clap Subcommand enum.
Seekable
Derives the Seekable trait for query-enabled structs.
Tabular
Derives a TabularSpec from struct field annotations.
TabularRow
Derives optimized row extraction for tabular formatting.