#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

#1523 in Rust patterns

Download history 19/week @ 2024-10-05 7/week @ 2024-10-12 16/week @ 2024-10-19 22/week @ 2024-10-26 11/week @ 2024-11-02 2/week @ 2024-11-09 12/week @ 2024-11-16 19/week @ 2024-11-23 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 45/week @ 2025-01-18

162 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