std_macro_extensions/string/macro.rs
1/// Creates a new `String` instance.
2///
3/// This macro can be used in two forms:
4/// - Without arguments, it creates an empty `String`.
5/// - With a string literal or expression, it creates a `String` initialized with the provided value.
6///
7/// # Examples
8/// ```
9/// use std_macro_extensions::*;
10/// let empty_string = string!();
11/// let hello_string = string!("Hello");
12/// ```
13#[macro_export]
14macro_rules! string {
15 () => {
16 std::string::String::new()
17 };
18 ($s:expr) => {
19 std::string::String::from($s)
20 };
21}