Crate ranting

Source
Expand description

Functions to handle Ranting trait placeholders.

§Feature flags

  • debug — Print during compilation each say!() pattern with its format!() conversion.

Macros§

ack
A wrapper for return Ok(say!())
boxed_ranting_trait
If you want to implement Ranting on a Box<&dyn Trait> where Trait has Ranting
nay
A wrapper for return Err(say!())
ref_ranting_trait
If you want to implement Ranting on a &'_ dyn Trait where Trait has Ranting
say
Functions like format!() for normal placeholders, but allows extended placeholders including e.g. articles or verbs beside a Noun or a variable with the Ranting trait. These are inflected accordingly, and adjustable by punctuation prefixes.

Structs§

Noun
Has the Ranting trait. Often you may want to #[derive(Ranting)] and sometimes override some of the trait functions.

Traits§

Ranting
The trait required for a struct or enum to function as a noun in a placeholder, derived with #[derive_ranting]. Functions are used in say!() placeholders replacements.

Functions§

handle_placeholder
The say macro parses placeholders and passes captures to this function which returns a string.
inflect_possesive
Inflect possesive pronoun as to_plural indicates. The first character capitalized with uc set.
is_subject
return whether the given &str is a valid subject
is_subjective_plural
Returns whether the subjective is plural. You is assumed singular; a plural_you ranting attribute should already be considered before this call.
uc_1st_if
upper cases first character if uc is true, or second in a contraction.