s_macro

Macro s

Source
s!() { /* proc-macro */ }
Expand description

Convenient way of making a String.

  1. s!()
  2. s!(123 + 321)
  3. s!("hello, {}", "world")

ยงExamples

use s_macro::s;

assert!(s!()                   == String::new());
assert!(s!("hello, world")     == String::from("hello, world"));
assert!(s!(123 + 321)          == format!("{}", 123 + 321));

let world = "world";
assert!(s!("hello, {}", world) == format!("hello, {}", world));
assert!(s!("hello, {world}")   == format!("hello, {world}"));