#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

#1515 in Rust patterns

Download history 6/week @ 2024-11-13 17/week @ 2024-11-20 17/week @ 2024-11-27 34/week @ 2024-12-04 46/week @ 2024-12-11 12/week @ 2024-12-18 22/week @ 2025-01-01 60/week @ 2025-01-08 47/week @ 2025-01-15 50/week @ 2025-01-22 7/week @ 2025-01-29 31/week @ 2025-02-05 26/week @ 2025-02-12 52/week @ 2025-02-19 78/week @ 2025-02-26

189 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