Skip to main content

Crate rich_macros

Crate rich_macros 

Source
Expand description

Compile-time checked markup and derive macros for the rich Rust port.

Use these through rs-rich-ext’s macros feature: it re-exports them and supplies the runtime they expand to (rich_ext::__private, rich_ext::derive).

Markup and styles are checked with the core’s own parsers, so a literal the macro accepts is one the runtime accepts, with one deliberate addition: the macros also reject unknown style names and unclosed tags, which the runtime renders silently as no-ops.

Macros§

markup
Check a markup literal at compile time and return it as &'static str. Accepts keys[...] before the literal, as richf! does.
richf
A Text from checked markup with format!-style placeholders.
style
A Style parsed at compile time: style!("bold red on white").
theme_key
A theme key checked against the default theme: theme_key!("repr.number") expands to the &'static str.

Attribute Macros§

inspect
Record an inherent impl block’s methods for rich_ext::inspect: each fn’s name, signature as written, doc comment, and whether it is pub or async. Mark the type #[inspect(methods)] to list them; one block per type. #[inspect(skip)] on a method leaves it out.

Derive Macros§

Inspect
Record what rich_ext::inspect reports on a struct or enum: the type’s name and doc comment, each field’s name, type as written, doc comment, visibility and value, and an enum’s variants.
Rich
Render a struct or enum through rich_ext::derive.