万本电子书0元读

万本电子书0元读

顶部广告

Rust Essentials - Second Edition电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Ivo Balbaert

出  版  社:Packt Publishing

出版时间:2017-11-08

字       数:29.8万

所属分类: 进口书 > 外文原版书 > 小说

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Leverage the functional programming and concurrency features of Rust and speed up your application development About This Book Get started with Rust to build scalable and high performance applications Enhance your application development skills using the power of Rust Discover the power of Rust when developing concurrent applications for large and scalable software Who This Book Is For The book is for developers looking for a quick entry into using Rust and understanding the core features of the language. Basic programming knowledge is assumed. What You Will Learn Set up your Rust environment to achieve the highest productivity Bridge the performance gap between safe and unsafe languages Use pattern matching to create flexible code Apply generics and traits to develop widely applicable code Organize your code in modules and crates Build macros to extend Rust's capabilities and reach Apply tasks to tackle problems concurrently in a distributed environment In Detail Rust is the new, open source, fast, and safe systems programming language for the 21st century, developed at Mozilla Research, and with a steadily growing community. It was created to solve the dilemma between high-level, slow code with minimal control over the system, and low-level, fast code with maximum system control. It is no longer necessary to learn C/C++ to develop resource intensive and low-level systems applications. This book will give you a head start to solve systems programming and application tasks with Rust. We start off with an argumentation of Rust's unique place in today's landscape of programming languages. You'll install Rust and learn how to work with its package manager Cargo. The various concepts are introduced step by step: variables, types, functions, and control structures to lay the groundwork. Then we explore more structured data such as strings, arrays, and enums, and you'll see how pattern matching works. Throughout all this, we stress the unique ways of reasoning that the Rust compiler uses to produce safe code. Next we look at Rust's specific way of error handling, and the overall importance of traits in Rust code. The pillar of memory safety is treated in depth as we explore the various pointer kinds. Next, you'll see how macros can simplify code generation, and how to compose bigger projects with modules and crates. Finally, you'll discover how we can write safe concurrent code in Rust and interface with C programs, get a view of the Rust ecosystem, and explore the use of the standard library. Style and approach The book takes a pragmatic approach, showing various methods to solve systems programming tasks with Rust and develop resource intensive and low-level systems applications.
目录展开

Title Page

Second Edition

Copyright

Rust Essentials

Second Edition

Credits

About the Author

About the Reviewer

www.PacktPub.com

Why subscribe?

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Customer support

Downloading the example code

Errata

Piracy

Questions

Starting with Rust

The advantages of Rust

The trifecta of Rust - safe, fast, and concurrent

Comparison with other languages

The stability of Rust and its evolution

The success of Rust

Where to use Rust

Servo

Installing Rust

rustc--the Rust compiler

Our first program

Working with Cargo

Developer tools

Using Sublime Text

The Standard Library

Summary

Using Variables and Types

Comments

Global constants

Printing with string interpolation

Values and primitive types

Consulting Rust documentation

Binding variables to values

Mutable and immutable variables

Scope of a variable and shadowing

Type checking and conversions

Aliasing

Expressions

The stack and the heap

Summary

Using Functions and Control Structures

Branching on a condition

Looping

Functions

Documenting a function

Attributes

Conditional compilation

Testing

Testing with cargo

The tests module

Summary

Structuring Data and Matching Patterns

Strings

Arrays, vectors, and slices

Vectors

Slices

Strings and arrays

Tuples

Structs

Enums

Result and Option

Getting input from the console

Matching patterns

Program arguments

Summary

Higher Order Functions and Error-Handling

Higher order functions and closures

Iterators

Consumers and adapters

Generic data structures and functions

Error-handling

Panics

Testing for failure

Some more examples of error-handling

The try! macro and the ? operator

Summary

Using Traits and OOP in Rust

Associated functions on structs

Methods on structs

Using a constructor pattern

Using a builder pattern

Methods on tuples and enums

Traits

Using trait constraints

Static and dynamic dispatch

Built-in traits and operator overloading

OOP in Rust

Inheritance with traits

Using the visitor pattern

Summary

Ensuring Memory Safety and Pointers

Pointers and references

Stack and heap

Lifetimes

Copying and moving values - The copy trait

Let's summarize

Pointers

References

Match, struct, and ref

Ownership and borrowing

Ownership

Moving a value

Borrowing a value

Implementing the Drop trait

Moving closure

Boxes

Reference counting

Overview of pointers

Summary

Organizing Code and Macros

Modules and crates

Building crates

Defining a module

Visibility of items

Importing modules and file hierarchy

Importing external crates

Exporting a public interface

Adding external crates to a project

Working with random numbers

Macros

Why macros?

Developing macros

Repetition

Creating a new function

Some other examples

Using macros from crates

Some other built-in macros

Summary

Concurrency - Coding for Multicore Execution

Concurrency and threads

Creating threads

Setting the thread's stack size

Starting a number of threads

Panicking threads

Thread safety

Shared mutable states

The Sync trait

Communication through channels

Sending and receiving data

Making a channel

Sending struct values over a channel

Sending references over a channel

Synchronous and asynchronous

Summary

Programming at the Boundaries

When is code unsafe

Using std::mem

Raw pointers

Interfacing with C

Using a C library

Inlining assembly code

Calling Rust from other languages

Summary

Exploring the Standard Library

Exploring std and the prelude module

Collections - using hashmaps and hashsets

Working with files

Paths

Reading a file

Error-handling with try!

Buffered reading

Writing a file

Error-handling with try!

Filesystem operations

Using Rust without the Standard Library

Summary

The Ecosystem of Crates

The ecosystem of crates

Working with dates and times

File formats and databases

Web development

Graphics and games

OS and embedded system development

Other resources for learning Rust

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部