Examples in "Rust Essentials" Book
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9/Codes
.gitignore
LICENSE
README.md
RustEssentials.sln

README.md

Rust Essentials

Examples in "Rust Essentials" Book

Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

Featuring

  • Zero-cost abstractions
  • move semantics
  • guaranteed memory safety
  • threads without data races
  • trait-based generics
  • pattern matching
  • type inference
  • minimal runtime
  • efficient C bindings

About

Examples in "Rust Essentials" book are built by Rust 1.0.0.

Currently, however, Rust stable version is 1.9.0.

Some semantics are changed and added.

So, I tested all examples by Rust 1.9.0(stable) and 1.11.0(nightly).

Diagram

Chapter 1

Codes

  • Welcome

  • WelcomeC (use cargo)

Exercises

  • Name

  • SmallestProgram

Chapter 2

Codes

  • Alias

  • Bindings

  • Comments

  • Constants1

  • Constants2

  • Expressions

  • MutableConstant

  • References

  • Scope

  • TypeConversions

  • TypeErrors

  • Types2

Exercises

  • ChangeConstant

  • CompoundLet

  • Formatting

Chapter 3

Codes

  • AttributesCfg

  • AttributesTesting

  • ExDoc (use rustdoc)

  • Functions

  • IfElse

  • IterStep

  • Loops

  • MyLib (use cargo)

  • Random (use cargo)

Exercises

  • Absolute

  • IfReturn

  • IfTest

Chapter 4

Codes

  • Arrays

  • Enums

  • Input

  • PatternMatch

  • PatternMatch2

  • Strings

  • Structs

  • Tuples

Exercises

  • CharsString

  • Monster

  • PatternMatch

  • TuplesEx

Chapter 5

Codes

  • AdapterConsumers

  • Errors

  • Generics

  • HigherFunctions

  • Iterators

  • Methods

  • TraitConstraints (use cargo)

  • Traits

Exercises

  • Complex

  • DrawTrait

  • Fold

  • RangeNext

Chapter 6

Codes

  • Boxes1

  • Boxes2

  • Errors

  • Lifetimes

  • Ownership1

  • Ownership2

  • Ref

  • RefCount

  • RefCountNotGood

  • References

Exercises

  • DanglingPointer

  • GrowTentacle

  • Ownership3

Chapter 7

Codes

  • Cube (use cargo)

  • ImportModules

  • Macros

  • Modules

  • Monsters (use cargo)

  • Structs

Exercises

  • MacroEx

  • PrivStruct

Chapter 8

Codes

  • Channels

  • Channels2

  • MakeChannel

  • ManyThreads

  • ManyThreads2 (use cargo)

  • NotShared

  • PanicThread

  • SyncChannel

  • ThreadSafe

  • ThreadSpawn

Exercises

  • SharedChannel

Chapter 9

Codes

  • Arguments

  • Asm (use nightly)

  • CallingCLibrary

  • CallingLibc (use nightly)

  • RawPointers

  • Unsafe

Dependencies

  • Rust Stable Release (1.9.0)
  • Rust Nightly Release (1.11.0)
  • Microsoft Visual Studio 2015
  • VisualRust

License

The class is licensed under the MIT License:

Copyright © 2016 Chris Ohk

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.