Macro qol::S

source ·
macro_rules! S {
    () => { ... };
    ("") => { ... };
    ($s:expr) => { ... };
}
Expand description

Create a string from the given type. Shorthand for "foo".to_string() or String::new().

use qol::S;

fn main() {
    assert_eq!(S!(), String::new());
    string(S!("foo"));
    string(S!(123));
    /* i_need_string("bar"); */ // expected String, found `&str`
}

fn string(_: String) {}