Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rust Programming Cookbook

You're reading from   Rust Programming Cookbook Explore the latest features of Rust 2018 for building fast and secure apps

Arrow left icon
Product type Paperback
Published in Oct 2019
Publisher Packt
ISBN-13 9781789530667
Length 444 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Claus Matzinger Claus Matzinger
Author Profile Icon Claus Matzinger
Claus Matzinger
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Starting Off with Rust FREE CHAPTER 2. Going Further with Advanced Rust 3. Managing Projects with Cargo 4. Fearless Concurrency 5. Handling Errors and Other Results 6. Expressing Yourself with Macros 7. Integrating Rust with Other Languages 8. Safe Programming for the Web 9. Systems Programming Made Easy 10. Getting Practical with Rust 11. Other Books You May Enjoy

Working with piped input data

Reading data from files is a very common task that we described in another recipe in this chapter (Writing to and reading from files). However, that's not always the best option. In fact, many Linux/Unix programs can be chained together using a pipe (|) to process an incoming stream. This allows for several things to be done:

  • Flexibility on the input source, static text, files, and networking streams—no need to change the programs
  • Run several processes, writing only the end result back to disk
  • Lazy evaluation of the stream
  • Flexible processing up-/downstream (for example, gzipping the output before writing to disk)

If you are not familiar with how this works, the pipe syntax may look cryptic. However, it actually stems from a functional programming paradigm (https://www.geeksforgeeks.org/functional-programming-paradigm/), where pipes...

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
Banner background image