#macro #println #shorthand #echon

nightly echo

Macro echo! for println!("{}"...) shorthand

1 unstable release

Uses old Rust 2015

0.0.1 Dec 10, 2014

#13 in #shorthand

MIT license

2KB

echo

Rust macro echo! and echon! as a shorthand for println!("{}"...) and print!("{}"...).

Usage

To use this library, add the following to your Cargo.toml file:

[dependencies]
echo = "*"

You can then use macro echo! and echon! to print space-separated values with or without newline, similar to Linux echo and echo -n commands.

#![feature(phase)]
#[phase(plugin)] extern crate echo;

fn main() {
    let a = 0u;
    let b = vec![2i, 4, 6];
    // 0 [2, 4, 6] true
    echo!(a, b, true);
    // 0 (without newline)
    echon!(a);
}

License

MIT


lib.rs:

Macro echo! and echon! print values separated by spaces without the need to specify "{}" format strings, similar to Linux echo and echo -n commands.

To use the macro, you'll need to include the following declarations at the top level of your crate:

#![feature(phase)]
#[phase(plugin)] extern crate echo;

Then you can invoke it as follows:

let a = 0u;
let b = vec![2i, 4, 6];
// 0 [2, 4, 6] true
echo!(a, b, true);
// 0 (without newline)
echon!(a);

No runtime deps