LibCoder

The Rust Programming Language. 2 Ed

1C Agda Rust
The Rust Programming Language. 2 Ed
Дата выхода: 2023
Издательство: No Starch Press, Inc.
Количество страниц: 1220
Размер файла: 3,2 МБ
Тип файла: PDF
Добавил: LibCoder
Оглавление
Title PageCopyrightAbout the AuthorsForewordPrefaceAcknowledgmentsIntroductionWho Rust Is ForTeams of DevelopersStudentsCompaniesOpen Source DevelopersPeople Who Value Speed and StabilityWho This Book Is ForHow to Use This BookResources and How to Contribute to This BookChapter 1: Getting StartedInstallationInstalling rustup on Linux or macOSInstalling rustup on WindowsTroubleshootingUpdating and UninstallingLocal DocumentationHello, World!Creating a Project DirectoryWriting and Running a Rust ProgramAnatomy of a Rust ProgramCompiling and Running Are Separate StepsHello, Cargo!Creating a Project with CargoBuilding and Running a Cargo ProjectBuilding for ReleaseCargo as ConventionSummaryChapter 2: Programming a Guessing GameSetting Up a New ProjectProcessing a GuessStoring Values with VariablesReceiving User InputHandling Potential Failure with ResultPrinting Values with println! PlaceholdersTesting the First PartGenerating a Secret NumberUsing a Crate to Get More FunctionalityGenerating a Random NumberComparing the Guess to the Secret NumberAllowing Multiple Guesses with LoopingQuitting After a Correct GuessHandling Invalid InputSummaryChapter 3: Common Programming ConceptsVariables and MutabilityConstantsShadowingData TypesScalar TypesCompound TypesFunctionsParametersStatements and ExpressionsFunctions with Return ValuesCommentsControl Flowif ExpressionsRepetition with LoopsSummaryChapter 4: Understanding OwnershipWhat Is Ownership?Ownership RulesVariable ScopeThe String TypeMemory and AllocationOwnership and FunctionsReturn Values and ScopeReferences and BorrowingMutable ReferencesDangling ReferencesThe Rules of ReferencesThe Slice TypeString SlicesOther SlicesSummaryChapter 5: Using Structs to Structure Related DataDefining and Instantiating StructsUsing the Field Init ShorthandCreating Instances from Other Instances with Struct Update SyntaxUsing Tuple Structs Without Named Fields to Create Different TypesUnit-Like Structs Without Any FieldsAn Example Program Using StructsRefactoring with TuplesRefactoring with Structs: Adding More MeaningAdding Useful Functionality with Derived TraitsMethod SyntaxDefining MethodsMethods with More ParametersAssociated FunctionsMultiple impl BlocksSummaryChapter 6: Enums and Pattern MatchingDefining an EnumEnum ValuesThe Option Enum and Its Advantages Over Null ValuesThe match Control Flow ConstructPatterns That Bind to ValuesMatching with Option<T>Matches Are ExhaustiveCatch-All Patterns and the _ PlaceholderConcise Control Flow with if letSummaryChapter 7: Managing Growing Projects with Packages, Crates, and ModulesPackages and CratesDefining Modules to Control Scope and PrivacyPaths for Referring to an Item in the Module TreeExposing Paths with the pub KeywordStarting Relative Paths with superMaking Structs and Enums PublicBringing Paths into Scope with the use KeywordCreating Idiomatic use PathsProviding New Names with the as KeywordRe-exporting Names with pub useUsing External PackagesUsing Nested Paths to Clean Up Large use ListsThe Glob OperatorSeparating Modules into Different FilesSummaryChapter 8: Common CollectionsStoring Lists of Values with VectorsCreating a New VectorUpdating a VectorReading Elements of VectorsIterating Over the Values in a VectorUsing an Enum to Store Multiple TypesDropping a Vector Drops Its ElementsStoring UTF-8 Encoded Text with StringsWhat Is a String?Creating a New StringUpdating a StringIndexing into StringsSlicing StringsMethods for Iterating Over StringsStrings Are Not So SimpleStoring Keys with Associated Values in Hash MapsCreating a New Hash MapAccessing Values in a Hash MapHash Maps and OwnershipUpdating a Hash MapHashing FunctionsSummaryChapter 9: Error HandlingUnrecoverable Errors with panic!Recoverable Errors with ResultMatching on Different ErrorsPropagating ErrorsTo panic! or Not to panic!Examples, Prototype Code, and TestsCases in Which You Have More Information Than the CompilerGuidelines for Error HandlingCreating Custom Types for ValidationSummaryChapter 10: Generic Types, Traits, and LifetimesRemoving Duplication by Extracting a FunctionGeneric Data TypesIn Function DefinitionsIn Struct DefinitionsIn Enum DefinitionsIn Method DefinitionsPerformance of Code Using GenericsTraits: Defining Shared BehaviorDefining a TraitImplementing a Trait on a TypeDefault ImplementationsTraits as ParametersReturning Types That Implement TraitsUsing Trait Bounds to Conditionally Implement MethodsValidating References with LifetimesPreventing Dangling References with LifetimesThe Borrow CheckerGeneric Lifetimes in FunctionsLifetime Annotation SyntaxLifetime Annotations in Function SignaturesThinking in Terms of LifetimesLifetime Annotations in Struct DefinitionsLifetime ElisionLifetime Annotations in Method DefinitionsThe Static LifetimeGeneric Type Parameters, Trait Bounds, and Lifetimes TogetherSummaryChapter 11: Writing Automated TestsHow to Write TestsThe Anatomy of a Test FunctionChecking Results with the assert! MacroTesting Equality with the assert_eq! and assert_ne! MacrosAdding Custom Failure MessagesChecking for Panics with should_panicUsing Result<T, E> in TestsControlling How Tests Are RunRunning Tests in Parallel or ConsecutivelyShowing Function OutputRunning a Subset of Tests by NameIgnoring Some Tests Unless Specifically RequestedTest OrganizationUnit TestsIntegration TestsSummaryChapter 12: An I/O Project: Building a Command Line ProgramAccepting Command Line ArgumentsReading the Argument ValuesSaving the Argument Values in VariablesReading a FileRefactoring to Improve Modularity and Error HandlingSeparation of Concerns for Binary ProjectsFixing the Error HandlingExtracting Logic from mainSplitting Code into a Library CrateDeveloping the Library’s Functionality with Test-Driven DevelopmentWriting a Failing TestWriting Code to Pass the TestWorking with Environment VariablesWriting a Failing Test for the Case-Insensitive Search FunctionImplementing the search_case_insensitive FunctionWriting Error Messages to Standard Error Instead of Standard OutputChecking Where Errors Are WrittenPrinting Errors to Standard ErrorSummary

Описание

Коротко и по делу о том, что важно знать про rust.

Thoroughly updated to Rust’s latest version, this edition is considered the language’s official documentation. With over 50,000 copies sold, The Rust Programming Language is the quintessential guide to programming in Rust. The Rust Programming Language "covers everything you could want to know about the language."—Stack Overflow Rust has been repeatedly voted "Most Loved Language" on the StackOverflow Developer Survey. Rust provides control of low-level details along with high-level ergonomics, allowing you to improve productivity and eliminate the hassle traditionally associated with low-level languages. The Rust Programming Language, 2nd Edition is the official guide to Rust 2021: an open source systems programming language that will help you write faster, more reliable software. Klabnik and Nichols, alumni of the Rust Core Team, share their knowledge to help you get the most out of Rust’s features so that you can create robust and scalable programs. You’ll begin with basics like creating functions, choosing data types, and binding variables, then move on to more advanced concepts, such as:

Ownership and borrowing, lifetimes, generics, traits, and trait objects to communicate your program’s constraints to the compiler

Smart pointers and multithreading, and how ownership interacts with them to enable fearless concurrency

How to use Cargo, Rust’s built-in package manager, to build, document your code, and manage dependencies

The best ways to test, handle errors, refactor, and take advantage of expressive pattern matching

In addition to the countless code examples, you’ll find three chapters dedicated to building complete projects: a number-guessing game, a Rust implementation of a command line tool, and a multithreaded server.

На этом основные моменты по теме закрыты.

rust language programming level guide edition official most

Частые вопросы

Можно ли скачать «The Rust Programming Language. 2 Ed» бесплатно?

Да, «The Rust Programming Language. 2 Ed» доступна для бесплатного скачивания на нашем сайте в формате PDF. Ссылка на файл находится на этой странице.

В каком формате и какого размера файл?

Книга предоставляется в формате PDF, размер файла 3,2 МБ.

Кто автор и когда вышла книга?

автор — Klabnik Steve , Nichols Carol, издательство No Starch Press, Inc., год выпуска 2023, 1220 страниц.

О чём книга «The Rust Programming Language. 2 Ed»?

With over 50,000 copies sold, The Rust Programming Language is the quintessential guide to programming in Rust.

Похожие материалы