stringlit/
lib.rs

1#[macro_export]
2macro_rules! s {
3    ($e:expr) => {
4        $e.to_owned() as String
5    };
6}
7
8#[macro_export]
9macro_rules! string {
10    ($e:expr) => {
11        $e.to_owned() as String
12    };
13}
14
15#[cfg(test)]
16mod test {
17    // enforces same type
18    fn strict_equals<T: std::cmp::PartialEq>(a: T, b: T) -> bool {
19        return a == b;
20    }
21
22    #[test]
23    fn same_type_and_value() {
24        assert!(strict_equals(s!("abcd"), "abcd".to_owned()));
25        assert!(strict_equals(string!("abcd"), "abcd".to_owned()));
26        println!("OK");
27    }
28}