1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! # `og_fmt` — Will the real `format!` please stand up?
//! 
//! ## **O.G. Rust Series™ — Rust as it really was**
//! 
//! ### 💯% True Rust · Accept No Substitutes 💯%
//! 
//! `og_fmt` brings back the legendary `fmt!` macro! [Removed from Rust in
//! 2013](https://github.com/rust-lang/rust/pull/8637#issuecomment-23191833),
//! `fmt!` is a more primal interpretation of the Rust string formatting
//! paradigm. Some say that the renaming of `fmt!` to `format!` was the
//! single largest mistake in the history of Rust. We'll never know what
//! might have been, but we can still recapture a bit of that original
//! formatting feeling.
//! 
//! Behold! `fmt!`
//! 
//! ### Example
//! 
//! ```rust
//! #[macro_use]
//! extern crate og_fmt;
//! 
//! fn main() {
//!     let msg = fmt!("Original fmt! is the #{} fmt!", 1);
//!     println!("{}", msg);
//! }
//! ```
//! 
//! ## About O.G. Rust Series™
//! 
//! _O.G. Rust Series™ — Rust as it really was_, restores Rust to its
//! original design, one crate at a time. O.G. Rust Series™ crates are
//! derived from the original source code of historical revisions of the
//! Rust compiler, and provide the most authentic Rust experience
//! available today.
//! 
//! Enjoy other fine crates in O.G Rust Series™ and share your
//! favorites #OGRust


/// Convert values into `String` like a winner.
///
/// See also [`format!`](https://doc.rust-lang.org/nightly/std/macro.format.html).
///
/// # Examples
///
/// ```
/// #[macro_use]
/// extern crate og_fmt;
///
/// fn main() {
///     fmt!("test");
///     fmt!("hello {}", "world!");
///     fmt!("x = {}, y = {y}", 10, y = 30);
/// }
/// ```
#[macro_export]
macro_rules! fmt {
    ($($arg:tt)*) => (::std::fmt::format(format_args!($($arg)*)))
}


/// Create fmting args like a winner.
///
/// See also [`format_args!`](https://doc.rust-lang.org/std/macro.format_args.html).
#[macro_export]
macro_rules! fmt_args { ($fmt:expr, $($args:tt)*) => ({
    format_args!($fmt, $($args), *)
}) }