Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rust High Performance

You're reading from   Rust High Performance Learn to skyrocket the performance of your Rust applications

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788399487
Length 272 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Iban Eguia Moraza Iban Eguia Moraza
Author Profile Icon Iban Eguia Moraza
Iban Eguia Moraza
Arrow right icon
View More author details
Toc

Macros

One of the most useful Rust functionalities is its macro ecosystem. You probably already know the println!() macro, but there are many more. These macros allow you to write complex boilerplate code (such as stdio handling in the println!() case) in a simple way and without having to add a ton of boilerplate code. Let's check out some of the most used ones.

Console printing

When you need to lock the standard I/O interface, then write bytes to it, and finally flush it for each call, the print!() and println!() macros allow you to do that by just giving them a formatting static string and a series of parameters. Not only that, you can use the whole std::fmt module to specify number precision, format things in debug...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime