1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::collections::HashMap;

use crate::JSONGetTextValue;

mod json_get_text_builder;
mod json_gettext;

#[cfg(feature = "rocketly")]
mod rocket_feature;

pub use self::json_gettext::*;

pub use json_get_text_builder::*;

#[cfg(feature = "rocketly")]
pub use rocket_feature::*;

pub type Key = String;

pub type Context<'a> = HashMap<Key, HashMap<String, JSONGetTextValue<'a>>>;

/**
Create a literal key.

```rust
#[macro_use] extern crate json_gettext;

let key = key!("en_US");

assert_eq!(String::from("en_US"), key);
```
*/
#[macro_export]
macro_rules! key {
    ($key:expr) => {
        format!($key)
    };
}