std_macro_extensions/string/
macro.rs

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