#string #str #macro

stringlit

A macro to convert from str to String

3 stable releases

2.1.0 Jul 4, 2023
2.0.0 Apr 25, 2019
1.0.0 Apr 24, 2019

#1056 in Rust patterns

Download history 8/week @ 2024-02-19 23/week @ 2024-02-26 8/week @ 2024-03-11 9/week @ 2024-03-25 44/week @ 2024-04-01

61 downloads per month

MIT license

3KB

stringlit

A macro to convert from str to String.

// import the macros
//
use stringlit::{s, string};

fn print_string(s: String) {
    println!("{}", s);
}

fn main() {
    // now you can use
    print_string(s!("test"));
    // or
    print_string(string!("test"));
    // instead of
    print_string("test".to_owned());
}

No runtime deps