Skip to main content

Crate ranting_derive

Crate ranting_derive 

Source

Macros§

ack
ask
ask!(speaker, audience, template, input) parses input against template exactly like heed!(), then forwards the captures to audience’s Answerable::answer(&speaker, captures). Returns Option<String> — None if input doesn’t match template.
boxed_ranting_trait
heed
heed!(template, input) matches input text against a template of literal words and captures — the inverse of what say!() does.
nay
ref_ranting_trait
say
say_with
say_with!(context, “fmt”, args…) is like say!() but resolves <, =, >, <=, %, <% tense markers against a runtime NarrationContext (falling back to the marker’s own default tense when the context doesn’t override it). The context also carries narration_person, register, and dialect — the latter two are inert in this crate and only reach Ranting::inflect_*_custom_with_context hooks for implementations that choose to read them (see ranting::Ranting).

Attribute Macros§

derive_ranting
Derives Ranting trait implementation and enables inflection within say!() placeholders. Implies #[derive(Ranting)] and includes name and subject in structs. For an enum "it" and the variant’s name are assumed.

Derive Macros§

Heed
Give a struct a #[heed(template = "...")] attribute and it gains fn heed(input: &str) -> Option<Self>, filling its fields from what the template captures.
Ranting
Above macros inflect Ranting elements within a placeholder. Structs require a name and subject String.