Ranting ╰(°Д°)/

github crates.io docs.rs

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

toml [dependencies] ranting = "0.1"


Details

```rust use ranting::*;

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

fn main() {

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

}

```

```rust

use ranting::*;

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

fn main() {

asserteq!( state(Noun::new("earl", "he"), "right"), "Hasn't he a right to say an earl's land is his?".tostring() ); asserteq!( state(Noun::new("farmers", "they"), "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.