#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

#1422 in Rust patterns

Download history 4/week @ 2024-07-21 39/week @ 2024-07-28 2/week @ 2024-08-04 8/week @ 2024-08-18 19/week @ 2024-08-25 36/week @ 2024-09-01 20/week @ 2024-09-08 27/week @ 2024-09-15 54/week @ 2024-09-22 67/week @ 2024-09-29 19/week @ 2024-10-06 8/week @ 2024-10-13 18/week @ 2024-10-20 20/week @ 2024-10-27 12/week @ 2024-11-03

58 downloads per month
Used in 2 crates

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