the_string_macro/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
#[macro_export]
macro_rules! string {
    ($lit:literal) => {
        String::from($lit)
    };
}

mod tests {
    #[test]
    fn test_string() {
        assert_eq!(string!("hello"), "hello".to_owned());
    }
}