Ranting ╰(°Д°)/
This library provides Ranting, a trait for inflection within say!() litteral string placeholders.
[]
= "0.1"
Details
- A
say!()macro produces a String similar toformat!(), but with placeholder markers a pronouns can be received. A verb alongside, always specified in plural, inflects accordingly.
use *;
#
-
Here,
Nounhas theRantingtrait. You can use#[derive(Ranting)]on a struct or enum fo similar behavior. A struct should also hve a name and a subject String variable. Use I .. they, thou or ye. -
A placeholder to display a Ranting variable has the structure:
- With
,and^lower- and uppercase are enforced, but a placeholder at sentence start is assumed to be uppercase. Also an article or verb with an uppercase enforces using an uppercase.
# use *;
#
-
An article, possesive
'sor verbs before the noun are also adapted. Normal variables just follow their Display or Debug traits. -
With the "inflector" feature, a given Ranting trait can also be inflected to plural or singular.
-
To force plurality use
+, for a singular use-. If prependeded by#var, plurality of the noun is adapted to the count of variable var. Which is displayed, unless prepended with a '?'. Other words within the placeholder are adapted as well. -
A Noun or pronoun is displayed dependent on its leading character or string marker.
- '?' - subject in inflection, but neither variable nor its space is displayed.
:- subject@- object`- possesive~- adjective- '*' - display the name, and mark that this is the Ranting element in the placeholder.
- '' - similarly, but passes
"word"and mutates the Ranting element.
-
If a Noun or plurality is hidden with a leading question mark, its inflection still applies.
-
The article can be one of
a,an,somethethoseorthese. These and those are converted to this and that if the pronoun is singular. -
ack!()andnay!()provide an Ok() / Err() return with asay!()formatted string included. Intended for allow / deny responses, rather than error handling.
Positional argument and numeric references are supported, but not named arguments.