Crate ifmt

Source
Expand description

A small crate which brings inline string interpolation to rust’s standard formatting macros.

§Examples

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

format!      -> iformat!
print!       -> iprint!
println!     -> iprintln!
eprint!      -> ieprint!
eprintln!    -> ieprintln!
write!       -> iwrite!
writeln!     -> iwriteln!
panic!       -> ipanic!
format_args! -> iformat_args!

Macros§

ieprint
Print an iformat!-ed string to standard error.
ieprintln
Print an iformat!-ed string to standard error, followed by \n.
iformat
Creates a String by interpolating inline expressions.
iformat_args
Create a fmt::Arguments value a la format_args! with inlined expressions (using the same syntax as iformat!).
ipanic
Panic with an iformat!-ed message.
iprint
Print an iformat!-ed string to standard out.
iprintln
Print an iformat!-ed string to standard out, followed by \n.
iwrite
Print an iformat!-ed string to the given buffer.
iwriteln
Print an iformat!-ed string to the given buffer, followed by \n.