liveBook · Manning

Println! macro

In Rust, println! is a standard-library macro that formats arguments and writes the resulting text followed by a newline to standard output.

How 2 Manning books explain it

Learn Rust in a Month of Lunches

The println! macro formats its arguments and writes the resulting text followed by a newline to standard output.

How it is used
Uses formatted printing to display messages and computed values in beginner Rust programs.
How deep it goes
Explains placeholders, formatting options, escapes, and alignment through examples, without detailing macro internals.
Examples
Uses greetings, multiplication results, compiler errors, pointer addresses, and aligned city names to illustrate printing.
What you can do after
Apply it in Rust programs to print values with placeholders and choose suitable formatting.

Read how Learn Rust in a Month of Lunches explains println! macro →

Rust in Action: Systems programming concepts and techniques

println! is Rust's standard macro for printing formatted output followed by a newline.

How it is used
Prints fixed or formatted values to the console while introducing Rust’s macro syntax.
How deep it goes
Explains macro notation, stdout, placeholders, and type handling, but treats macros as function-like rather than exposing expansion internals.
Examples
Demonstrates greetings in three languages, iterated strings, formatted placeholders, and CSV-processing output.
What you can do after
Apply it via Rust syntax to print messages and formatted values during small programs and data-processing tasks.

Read how Rust in Action: Systems programming concepts and techniques explains println! macro →

Also covered in

What to know first

Related concepts

Questions about println! macro

What is println! macro?

In Rust, println! is a standard-library macro that formats arguments and writes the resulting text followed by a newline to standard output.

Which Manning books explain println! macro?

Learn Rust in a Month of Lunches and Rust in Action: Systems programming concepts and techniques.

What should I know before learning println! macro?

Manning books that teach println! macro usually introduce inheritance and Rust first.

What is the difference between println! macro and dbg! macro?

In Rust, println! is a standard-library macro that formats arguments and writes the resulting text followed by a newline to standard output. The Rust dbg! macro evaluates an expression, prints debugging information including its source and value, and returns the expression’s value.

What is println! macro a kind of?

Println! macro is a kind of macro. A macro is a named, reusable construct that expands into generated code or a sequence of commands when invoked, often during preprocessing, compilation, or application execution.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.