34,79 €
Mozilla’s Rust is gaining much attention with amazing features and a powerful library. This book will take you through varied recipes to teach you how to leverage the Standard library to implement efficient solutions.
The book begins with a brief look at the basic modules of the Standard library and collections. From here, the recipes will cover packages that support file/directory handling and interaction through parsing. You will learn about packages related to advanced data structures, error handling, and networking. You will also learn to work with futures and experimental nightly features. The book also covers the most relevant external crates in Rust.
By the end of the book, you will be proficient at using the Rust Standard library.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 418
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Merint MathewAcquisition Editor: Aiswarya Narayanan, Alok DhuriContent Development Editor: Lawrence VeigasTechnical Editor: Mehul SinghCopy Editor: Safis EditingProject Coordinator: Prajakta NaikProofreader: Safis EditingIndexer: Rekha NairGraphics: Jisha ChirayilProduction Coordinator: Deepika Naik
First published: March 2018
Production reference: 2020322
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78862-392-6
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
Jan Hohenheim is a senior software engineer and an active contributor to, and advocator of, the open source community. Over the years, he has acquired a deep understanding of systems programming through languages such as C++ and Rust by modernizing and refactoring big and complex codebases. His passions include all things AI and Blockchain. In his free time, he researches innovative approaches to bringing biology and technology closer together, which has led him to develop his own Machine Learning framework. You can follow his projects on GitHub. His username is jnferner.
Daniel Durante is an avid coffee drinker/roaster, motorcyclist, archer, welder, and carpenter whenever he isn’t programming. Right from the age of 12, he has been involved with web and embedded programming with PHP, Node.js, Golang, Rust, and C. He has worked on text-based browser games that have reached over 1,000,000 active players, created bin-packing software for CNC machines, embedded programming with cortex-m and PIC circuits, high-frequency trading applications, and helped contribute to one of the oldest ORMs of Node.js (SequelizeJS).
Ruben Schmidmeister is a senior software engineer. He has a broad knowledge of all things web and Unix. Over the last 2 years, he has been coding in Rust. His latest Rust project is an open source production-oriented server deployment tool called Toby.
He open sources most of his projects on GitHub under the username bash, so be sure to check that out.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Rust Standard Library Cookbook
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Disclaimer
Learning the Basics
Introduction
Concatenating strings
Getting ready
How to do it...
How it works...
Using the format! macro
How to do it...
How it works...
There's more...
Providing a default implementation
How to do it...
How it works...
Using the constructor pattern
Getting ready
How to do it...
How it works...
There's more...
See also
Using the builder pattern
How to do it...
How it works...
There's more...
Parallelism through simple threads
How to do it...
How it works...
There's more...
See also
Generating random numbers
How to do it...
How it works...
There's more...
Querying with regexes
Getting ready
How to do it...
How it works...
There's more...
See also
Accessing the command line
How to do it...
How it works...
There's more...
Interacting with environment variables
How to do it...
How it works...
There's more...
Reading from stdin
How to do it...
How it works...
There's more...
See also
Accepting a variable number of arguments
Getting started
How to do it...
How it works...
There's more...
See also
Working with Collections
Introduction
Using a vector
How to do it...
How it works...
There's more...
Using a string
How to do it...
How it works...
There's more...
Accessing collections as iterators
How to do it...
How it works...
There's more...
See also
Using a VecDeque
How to do it...
How it works...
There's more...
Using a HashMap
How to do it...
How it works...
There's more...
Using a HashSet
How to do it...
How it works...
There's more...
Creating an own iterator
How to do it...
How it works...
There's more...
Using a slab
How to do it...
How it works...
There's more...
Handling Files and the Filesystem
Introduction
Working with text files
How to do it...
How it works...
There's more...
See also
Handling bytes
Getting ready
How to do it...
How it works...
There's more...
Working with binary files
How to do it...
How it works...
There's more...
See also
Compressing and decompressing data
How to do it...
How it works...
There's more...
Traversing the filesystem
Getting ready
How to do it...
How it works...
There's more...
See also
Finding files with glob patterns
How to do it...
How it works...
See also
Serialization
Introduction
Working with CSV
Getting started
How to do it...
How it works...
There's more...
See also
Serialization basics with Serde
How to do it...
How it works...
There's more...
See also
Working with TOML
Getting started
How to do it...
How it works...
There's more...
See also
Working with JSON
Getting ready
How to do it...
How it works...
There's more...
See also
Building JSON dynamically
How to do it...
How it works...
See also
Advanced Data Structures
Introduction
Creating lazy static objects
How to do it...
How it works...
There's more...
See also
Working with bit fields
Getting started
How to do it...
How it works...
See also
Providing custom derives
Getting started
How to do it...
How it works...
There's more...
Converting types into each other
How to do it...
How it works...
Boxing data
How to do it...
How it works...
There's more...
See also
Sharing ownership with smart pointers
How to do it...
How it works...
There's more...
See also
Working with interior mutability
How to do it...
How it works...
There's more...
See also
Handling Errors
Introduction
Providing user-defined error types
How to do it...
How it works...
There's more...
Providing logging
How to do it...
How it works...
There's more...
Creating a custom logger
How to do it...
How it works...
There's more...
See also
Implementing the Drop trait
How to do it...
How it works...
There's more...
See also
Understanding RAII
How to do it...
How it works...
There's more...
See also
Parallelism and Rayon
Introduction
Parallelizing iterators
How to do it...
How it works...
See also
Running two operations together
How to do it...
How it works...
There's more...
See also
Sharing resources in multithreaded closures
How to do it...
How it works...
See also
Sending data across threads
How to do it...
How it works...
There's more...
See also
Accessing resources in parallel with RwLocks
How to do it...
How it works...
There's more...
See also
Atomically accessing primitives
How to do it...
How it works...
There's more...
See also
Putting it all together in a connection handler
How to do it...
How it works...
There's more...
Working with Futures
Introduction
Providing futures with a CPU pool and waiting for them
How to do it...
How it works...
Handling errors in futures
How to do it...
How it works...
See also
Combining futures
How to do it...
How it works...
See also
Using Streams
How to do it...
How it works...
Using Sinks
How to do it...
How it works...
Using the oneshot channel
How to do it...
How it works...
Returning futures
How to do it...
How it works...
There's more...
See also
Locking resources with BiLocks
How to do it...
How it works...
Networking
Introduction
Setting up a basic HTTP server
Getting ready
How to do it...
How it works...
See also
Configuring an HTTP server to perform echoing and routing
Getting ready
How to do it...
How it works...
Configuring an HTTP server to perform file serving
How to do it...
How it works...
There's more...
See also
Making requests to APIs
How to do it...
How it works...
There's more...
See also
Using Experimental Nightly Features
Introduction
Iterating over an inclusive range
How to do it...
How it works...
See also
Returning abstract types
How to do it...
How it works...
There's more...
See also
Composing functions
How to do it...
How it works...
See also
Filtering strings efficiently
How to do it...
How it works...
See also
Stepping through an iterator in regular intervals
How to do it...
How it works...
See also
Benchmarking your code
How to do it...
How it works...
There's more...
See also
Using generators
How to do it...
How it works...
See also
Other Books You May Enjoy
Leave a review - let other readers know what you think
