The Rust Programming Language is the official book on Rust; a community-developed, systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Rust’s memory safety guarantees, enforced at compile time, safeguard your programs against the many problems that pervade other systems languages. Rust offers the control and performance of a low-level language with the helpful abstractions of a high level one, and does this all without having a garbage collector. These characteristics make Rust useful for embedding in other languages, programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems. The Rust Programming Language begins with a quick hands-on project to introduce the basics, then explores key concepts in depth, such as ownership, the type system, error handling, and fearless concurrency. Detailed explanations of Rust-oriented takes on topics like pattern matching, iterators, and smart pointers combine with examples and exercises to take you from theory to practice. In addition to its thorough coverage of more granular topics, The Rust Programming Language will show you how to: -Grasp important concepts unique to Rust like ownership, borrowing, and lifetimes -Use Cargo, Rust’s built-in package manager, to build your code, including downloading and building dependencies -Effectively use Rust’s zero-cost abstractions and learn to build your own Developed with help from the community, The Rust Programming Language is your official guide to becoming a productive Rust programmer.
Get familiar with writing programs in the trending new systems programming language that brings together the powerful performance of low-level languages with the advanced features like thread safety in multi-threaded code Key Features Learn the semantics of Rust, which can be significantly different from other programming languages Understand clearly how to work with the Rust compiler which strictly enforces rules that may not be obvious Examples and insights beyond the Rust documentation Book Description Rust is an emerging programming language applicable to areas such as embedded programming, network programming, system programming, and web development. This book will take you from the basics of Rust to a point where your code compiles and does what you intend it to do! This book starts with an introduction to Rust and how to get set for programming, including the rustup and cargo tools for managing a Rust installation and development workflow. Then you'll learn about the fundamentals of structuring a Rust program, such as functions, mutability, data structures, implementing behavior for types, and many more. You will also learn about concepts that Rust handles differently from most other languages. After understanding the Basics of Rust programming, you will learn about the core ideas, such as variable ownership, scope, lifetime, and borrowing. After these key ideas, you will explore making decisions in Rust based on data types by learning about match and if let expressions. After that, you'll work with different data types in Rust, and learn about memory management and smart pointers. What you will learn Install Rust and write your first program with it Understand ownership in Rust Handle different data types Make decisions by pattern matching Use smart pointers Use generic types and type specialization Write code that works with many data types Tap into the standard library Who this book is for This book is for people who are new to Rust, either as their first programming language or coming to it from somewhere else. Familiarity with computer programming in any other language will be helpful in getting the best out of this book.
This book is a guide for you to learn the Rust Programming Language. The first part of the book is a guide for you on how to get started with the Rust programming language. The author takes you through the initial steps of setting up the environment and writing your "Hello Word!" program. The various primitive data types supported in Rust have been discussed, hence you will know how to use them when programming. You are also guided on how to work with Rust variables. Conversion of types through casting has been discussed in detail; hence, you will know how to convert one type to another. The control of the flow of execution has been discussed. You will learn how to use the various flow control statements in Rust. Loops have also been explored in detail to help you learn how to perform Rust task repeatedly. The author guides you on how to match patterns in Rust. The storage of data by use of vectors has also been explored. Closures and Traits are also popular Rust features. The author has discussed them in detail. The following topics have been discussed in this book: - Getting Started with Rust - Primitives -Variables - Type Casting - Flow Control - Loops - Functions - Traits - Pattern Matching - Vectors - Generics - Closures
75-80 recipes for learning Rust programming About This Book Learn to build high-performance Rust units and integrate them into your existing application Work through recipes on performance, robustness, security, memory management, and scalability Work through recipes to build foreign function interface with C, JS, and Python Who This Book Is For If you want to write Rust programs, then this book is for you. This book is for those who have a basic knowledge of Rust or any programming language. If you are a C/C developer who is migrating to Rust for various reasons, this book is ideal for you. What You Will Learn Understand system programming language problems and see how Rust provides unique solutions Get to know the core concepts of Rust to develop fast and safe applications Explore the possibility of integrating Rust units into existing applications to make them more efficient Achieve better parallelism, security, and performance Explore ways to package your Rust application and ship it for deployment in a production environment Discover how to build web applications and services using Rust to provide high-performance to the end user In Detail If you are building concurrent applications, server-side programs, or high-performance applications, you will benefit from this language. This book comes with a lot of application-specific recipes to kick-start your development of real-world high-performance applications with the Rust programming language and integrating Rust units into your existing applications. In this book, you will find some 80 practical recipes written in Rust that will allow you to use the code samples right away in your existing applications. These recipes have been tested with stable rust compiler versions of 1.14.0 and above. This book will help you understand the core concepts of the Rust language, enabling you to develop efficient and high-performance applications by incorporating features such as zero cost abstraction and better memory management. We'll delve into advanced-level concepts such as error handling, macros, crates, and parallelism in Rust. Toward the end of the book, you will learn how to create HTTP servers and web services, building a strong foundational knowledge in server-side programming and enabling you to deliver solutions to build high-performance and safer production-level web applications and services using Rust. Style and approach This book helps you learn the core concepts of Rust faster by taking a recipe-based approach, where you can try out different code snippets to understand a concept.
Discover the powerful, hidden features of Rust you need to build robust, concurrent, and fast applications About This Book Learn how concurrency works in Rust and why it is safe Get to know the different philosophies of error handling and how to use them wisely After reading this book, you will be able to migrate your legacy C or C++ application to a Rust environment Who This Book Is For The target audience would be readers having knowledge of other programming languages and are able to work fluently in the operating system of their choice, be it Linux, OS X or Windows. Since Rust is a rather new language, they are interested in programming beyond simply using it for work. The book focuses on intermediate and advanced features of Rust. What You Will Learn Implement unit testing patterns with the standard Rust tools Get to know the different philosophies of error handling and how to use them wisely Appreciate Rust's ability to solve memory allocation problems safely without garbage collection Get to know how concurrency works in Rust and use concurrency primitives such as threads and message passing Use syntax extensions and write your own Create a Web application with Rocket Use Diesel to build safe database abstractions In Detail If concurrent programs are giving you sleepless nights, Rust is your go-to language. Being one of the first ever comprehensive books on Rust, it is filled with real-world examples and explanations, showing you how you can build scalable and reliable programs for your organization. We'll teach you intermediate to advanced level concepts that make Rust a great language. Improving performance, using generics, building macros, and working with threads are just some of the topics we'll cover. We'll talk about the official toolsets and ways to discover more. The book contains a mix of theory interspersed with hands-on tasks, so you acquire the skills as well as the knowledge. Since programming cannot be learned by just reading, we provide exercises (and solutions) to hammer the concepts in. After reading this book, you will be able to implement Rust for your enterprise project, deploy the software, and will know the best practices of coding in Rust. Style and approach This book is your one stop guide to the Rust programming language and covers advanced-level concepts in a detailed manner using real-world examples.
Programming Language Explorations is a tour of several modern programming languages in use today. The book teaches fundamental language concepts using a language-by-language approach. As each language is presented, the authors introduce new concepts as they appear, and revisit familiar ones, comparing their implementation with those from languages seen in prior chapters. The goal is to present and explain common theoretical concepts of language design and usage, illustrated in the context of practical language overviews. Twelve languages have been carefully chosen to illustrate a wide range of programming styles and paradigms. The book introduces each language with a common trio of example programs, and continues with a brief tour of its basic elements, type system, functional forms, scoping rules, concurrency patterns, and sometimes, metaprogramming facilities. Each language chapter ends with a summary, pointers to open source projects, references to materials for further study, and a collection of exercises, designed as further explorations. Following the twelve featured language chapters, the authors provide a brief tour of over two dozen additional languages, and a summary chapter bringing together many of the questions explored throughout the text. Targeted to both professionals and advanced college undergraduates looking to expand the range of languages and programming patterns they can apply in their work and studies, the book pays attention to modern programming practice, covers cutting-edge languages and patterns, and provides many runnable examples, all of which can be found in an online GitHub repository. The exploration style places this book between a tutorial and a reference, with a focus on the concepts and practices underlying programming language design and usage. Instructors looking for material to supplement a programming languages or software engineering course may find the approach unconventional, but hopefully, a lot more fun.
Get to grips with modern software demands by learning the effective uses of Rust's powerful memory safety. Key Features Learn and improve the sequential performance characteristics of your software Understand the use of operating system processes in a high-scale concurrent system Learn of the various coordination methods available in the Standard library Book Description Most programming languages can really complicate things, especially with regard to unsafe memory access. The burden on you, the programmer, lies across two domains: understanding the modern machine and your language's pain-points. This book will teach you to how to manage program performance on modern machines and build fast, memory-safe, and concurrent software in Rust. It starts with the fundamentals of Rust and discusses machine architecture concepts. You will be taken through ways to measure and improve the performance of Rust code systematically and how to write collections with confidence. You will learn about the Sync and Send traits applied to threads, and coordinate thread execution with locks, atomic primitives, data-parallelism, and more. The book will show you how to efficiently embed Rust in C++ code and explore the functionalities of various crates for multithreaded applications. It explores implementations in depth. You will know how a mutex works and build several yourself. You will master radically different approaches that exist in the ecosystem for structuring and managing high-scale systems. By the end of the book, you will feel comfortable with designing safe, consistent, parallel, and high-performance applications in Rust. What you will learn Probe your programs for performance and accuracy issues Create your own threading and multi-processing environment in Rust Use coarse locks from Rust’s Standard library Solve common synchronization problems or avoid synchronization using atomic programming Build lock-free/wait-free structures in Rust and understand their implementations in the crates ecosystem Leverage Rust’s memory model and type system to build safety properties into your parallel programs Understand the new features of the Rust programming language to ease the writing of parallel programs Who this book is for This book is aimed at software engineers with a basic understanding of Rust who want to exploit the parallel and concurrent nature of modern computing environments, safely.
Explore the support Rust offers for creating functional applications in Rust. Learn about various design patterns, implementing concurrency, metaprogramming, and so on in the process Key Features Learn generics, organization, and design patterns in functional programming Modularize your applications and make them highly reusable and testable using functional design patterns Get familiar with complex concepts such as metaprogramming, concurrency, and immutability Book Description Functional programming allows developers to divide programs into smaller, reusable components that ease the creation, testing, and maintenance of software as a whole. Combined with the power of Rust, you can develop robust and scalable applications that fulfill modern day software requirements. This book will help you discover all the Rust features that can be used to build software in a functional way. We begin with a brief comparison of the functional and object-oriented approach to different problems and patterns. We then quickly look at the patterns of control flow, data the abstractions of these unique to functional programming. The next part covers how to create functional apps in Rust; mutability and ownership, which are exclusive to Rust, are also discussed. Pure functions are examined next and you'll master closures, their various types, and currying. We also look at implementing concurrency through functional design principles and metaprogramming using macros. Finally, we look at best practices for debugging and optimization. By the end of the book, you will be familiar with the functional approach of programming and will be able to use these techniques on a daily basis. What you will learn How Rust supports the use of basic functional programming principles Use functional programming to handle concurrency with elegance Read and interpret complex type signatures for types and functions Implement powerful abstractions using meta programming in Rust Create quality code formulaically using Rust's functional design patterns Master Rust's complex ownership mechanisms particularly for mutability Who this book is for This book is for Rust developers who are comfortable with the language and now want to improve their coding abilities by learning advanced functional techniques to enhance their skillset and create robust and testable apps.
A comprehensive guide in developing and deploying high performance microservices with Rust Key Features Start your microservices journey and get a broader perspective on microservices development using RUST 2018, Build, deploy, and test microservices using AWS Explore advanced techniques for developing microservices such as actor model, Requests Routing, and threads Book Description Microservice architecture is sweeping the world as the de facto pattern for building web-based applications. Rust is a language particularly well-suited for building microservices. It is a new system programming language that offers a practical and safe alternative to C. This book describes web development using the Rust programming language and will get you up and running with modern web frameworks and crates with examples of RESTful microservices creation. You will deep dive into Reactive programming, and asynchronous programming, and split your web application into a set of concurrent actors. The book provides several HTTP-handling examples with manageable memory allocations. You will walk through stateless high-performance microservices, which are ideally suitable for computation or caching tasks, and look at stateful microservices, which are filled with persistent data and database interactions. As we move along, you will learn how to use Rust macros to describe business or protocol entities of our application and compile them into native structs, which will be performed at full speed with the help of the server's CPU. Finally, you will be taken through examples of how to test and debug microservices and pack them into a tiny monolithic binary or put them into a container and deploy them to modern cloud platforms such as AWS. What you will learn Get acquainted with leveraging Rust web programming Get to grips with various Rust crates, such as hyper, Tokio, and Actix Explore RESTful microservices with Rust Understand how to pack Rust code to a container using Docker Familiarize yourself with Reactive microservices Deploy your microservices to modern cloud platforms such as AWS Who this book is for This book is for developers who have basic knowledge of RUST, and want to learn how to build, test, scale, and manage RUST microservices. No prior experience of writing microservices in RUST is assumed.