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 70 71 72 73
/*! A small crate which brings inline string interpolation to rust's standard formatting macros. # Examples ```rust use ifmt::iprintln; let four = 4; iprintln!("four plus four is: {four + 4}"); // four plus four is: 8 iprintln!("here's a hex number: 0x{0xb0bi64 * 1321517i64 :x}"); // here's a hex number: 0xdeadbeef iprintln!("here's a debugging value: {Some(four):?}"); // here's a debugging value: Some(4) ``` # Supported macros ```ignore format! -> iformat! print! -> iprint! println! -> iprintln! eprint! -> ieprint! eprintln! -> ieprintln! write! -> iwrite! writeln! -> iwriteln! format_args! -> iformat_args! ``` */ use proc_macro_hack::proc_macro_hack; /// Creates a String by interpolating inlined expressions. /// Takes one argument, which must be a string literal. /// /// Works by expanding to `format!`: /// /// `iformat!("two plus two: {2 + 2}") -> format!("two plus two: {}", {2 + 2})` /// /// `iformat!("foo: {foo:?}") -> format!("foo: {:?}", {foo})` #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iformat; /// Print an [`iformat!`][iformat]-ed string to standard out. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iprint; /// Print an [`iformat!`][iformat]-ed string to standard out, followed by `\n`. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iprintln; /// Print an [`iformat!`][iformat]-ed string to standard error. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::ieprint; /// Print an [`iformat!`][iformat]-ed string to standard error, followed by `\n`. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::ieprintln; /// Print an [`iformat!`][iformat]-ed string to the given buffer. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iwrite; /// Print an [`iformat!`][iformat]-ed string to the given buffer, followed by `\n`. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iwriteln; /// Create a `fmt::Arguments` value a la `format_args!` with inlined expressions (using the same syntax as [`iformat!`][iformat]). #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::iformat_args; /// Panic with an [`iformat!`][iformat]-ed message. #[proc_macro_hack(fake_call_site)] pub use ifmt_impl::ipanic;