Ranting ╰(°Д°)/

github crates.io docs.rs

This library provides Ranting, a trait for inflection within say!() litteral string placeholders.

toml [dependencies] ranting = "0.2"


Details

```rust use ranting::; use ranting_derive::;

fn say_name(who: Noun) -> String { say!("{=who do} say {`who} name is {who}.") }

fn main() { asserteq!( sayname(Noun::new("Jane", "I")), "I do say my name is Jane.".tostring() ); asserteq!( sayname(Noun::new("Tarzan", "he")), "He does say his name is Tarzan.".tostring() ); } ```

```rust fn state(who: T, liberty: &str) -> String { say!("{haven't =who} a {liberty} to say {a who's} land is {~who}?") }

[derive_ranting]

[ranting(subject = "he")]

struct Earl {}

[derive_ranting]

[ranting(subject = "they")]

struct Farmers {}

fn main() { asserteq!( state(Earl {}, "right"), "Hasn't he a right to say an earl's land is his?".tostring() ); asserteq!( state(Farmers {}, "right"), "Haven't they a right to say some farmers' land is theirs?".tostring() ); } ```

Positional argument and numeric references are supported, but not named arguments.