#string #macro #str

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

#2721 in Rust patterns

Download history 25/week @ 2024-11-30 46/week @ 2024-12-07 30/week @ 2024-12-14 6/week @ 2024-12-28 42/week @ 2025-01-04 69/week @ 2025-01-11 51/week @ 2025-01-18 14/week @ 2025-01-25 18/week @ 2025-02-01 27/week @ 2025-02-08 39/week @ 2025-02-15 75/week @ 2025-02-22 39/week @ 2025-03-01 33/week @ 2025-03-08 42/week @ 2025-03-15

198 downloads per month
Used in 5 crates (4 directly)

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