Home Page Icon
Home Page
Table of Contents for
Creative Projects for Rust Programmers
Close
Creative Projects for Rust Programmers
by Carlo Milanesi
Creative Projects for Rust Programmers
Title Page
Copyright and Credits
Creative Projects for Rust Programmers
Dedication
About Packt
Why subscribe?
Contributors
About the author
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
Download the color images
Conventions used
Get in touch
Reviews
Rust 2018: Productivity
Technical requirements
Understanding the different editions of Rust
The projects
Working through the examples in this book
Exploring some utility crates
Pseudo-random number generators – the rand crate
Logging – the log crate
Initializing static variables at runtime – the lazy_static crate
Parsing the command line – the structopt crate
Summary
Questions
Storing and Retrieving Data
Technical requirements
Project overview
Reading a TOML file
Using toml_dynamic
Using toml_static
Reading and writing a JSON file
The json_dynamic project
The json_static project
Reading an XML file
Accessing databases
Accessing a SQLite database
Implementing the project
Accessing a PostgreSQL database
Implementation of the project
Storing and retrieving data from a Redis store
Implementing the project
Putting it all together
Summary
Questions
Creating a REST Web Service
Technical requirements
The REST architecture
Project overview
Essential background theory and context
Building a stub of a REST web service
Running and testing the service
Getting a resource using the GET method
Sending a named resource to the server using the PUT method
Sending a new resource to the server using the POST method
Deleting a resource using the DELETE method
Sending an invalid command
Examining the code
Building a complete web service
Downloading a file
Uploading a string to a specified file
Uploading a string to a new file
Deleting a file
Examining the code
Building a stateful server
How to have a stateful server
The API of this service
Testing the service
Implementing the database
Handling queries
Returning JSON data
Summary
Questions
Further reading
Creating a Full Server-Side Web App
Technical requirements
Definition of a web app
Understanding the behavior of a web app
Project overview
Using the Tera template engine
A simple list of persons
The templates folder
The other Rust handlers
A CRUD application
The JavaScript code
The HTML code
The Rust code
The db_access.rs changes
The main.rs changes
Handling an application with authentication
The implementation
The HTML code
The JavaScript code
The mock database code
The main function
Summary
Questions
Further reading
Creating a Client-Side WebAssembly App Using Yew
Technical requirements
Introducing Wasm
Understanding the MVC architectural pattern
Implementing two toy web apps
What is the MVC pattern?
The model
The view
The controller
View implementation
Controller implementation
Understanding the MVC architecture
Project overview
Getting started
The incr app
The adder app
The login app
Organization of the project
The db_access.rs file
The main.rs file
The login.rs file
The yauth app
Understanding the behavior of the app
Organization of the project
The persons_list.rs file
Why an empty collection wouldn't be good for filtered_persons
The one_person.rs file
A web app accessing a RESTful service
The persons_db app
The yclient app
The imported crates
The source files
The changes to the models
A typical client/server request
Summary
Questions
Further reading
Creating a WebAssembly Game Using Quicksilver
Technical requirements
Project overview
Understanding the animation loop architecture
Implementing the ski project
Understanding the code behind this
Implementing the silent_slalom project
Implementing the assets_slalom project
Analyzing the code
Summary
Questions
Further reading
Creating a Desktop Two-Dimensional Game Using ggez
Technical requirements
Project overview
Understanding linear algebra
Implementing the gg_ski project
The main function
Patterns of input handling
Input handling in the gg_ski project
Other differences with quicksilver
Name of the trait
The type of context
The new method
The angle's unit of measurement
How to specify the FPS rate
Handling the ski steering
Computation of new position and speed
Drawing the background
Drawing composite shapes
Ending the draw method
Implementing the gg_silent_slalom project
Implementing the gg_assets_slalom project
Implementing the gg_whac project
The assets
The general structure of the application and events
Other fields of the model
Defining a widget
Summary
Questions
Further reading
Using a Parser Combinator for Interpreting and Compiling
Technical requirements
Project overview
Introducing Calc
Understanding formal languages and their parsers
Regular languages
Context-free languages
Context-dependent languages
Using Nom to build parsers
Learning about compiler-compilers and parser combinators
Learning the basics of Nom
Parsing an alternative of characters
Parsing a sequence of characters
Parsing a fixed string
Mapping parsed items to other objects
Creating custom parsing results
Parsing a variable text
Repeating a parser
The calc_parser project
Understanding the main.rs source file
Learning about the parser.rs source file
Understanding the types needed by the parser
Looking at the parser code
The calc_analyzer project
Checking the variables of the parsed program
Understanding the main.rs file
Looking at the symbol_table.rs file
Glancing at the analyzer.rs file
The calc_interpreter project 
Learning about the main.rs file
Glancing at the symbol_table.rs file
Understanding the executor.rs file
The calc_compiler project
Glancing at the main.rs file
Understanding the compiler.rs file
Summary
Questions
Further reading
Creating a Computer Emulator Using Nom
Technical requirements
Project overview
Introducing a very simple machine language
The most important concepts relating to machine language
Extending our machine language
Writing a very simple program
A more complex program – the sieve of Eratosthenes
Defining a byte-addressing machine language
Coping with the endianness issue
The nom_byte_machine project
Understanding the main.rs source file
Using the Nom library
The emulator.rs source file
The parsing_interpreter.rs source file
The translator.rs source file
The nom_disassembler project
Running the project
Examining the source code
Generating disassembly code that is useful for debugging
Generating disassembly code that is useful for reassembling
Summary
Questions
Creating a Linux Kernel Module
Technical requirements
Project overview
Understanding kernel modules
Preparing the environment
A boilerplate module
Building and running the kernel module
The build commands
The source code of the boilerplate module
Using global variables
Allocating memory
A character device
Building the character device
The source code of the dots module
The global information
The initialization call
The cleanup call
The reading function
Summary
Questions
Further reading
The Future of Rust
IDEs and interactive programming
Crate maturity
Asynchronous programming
Optimization
The const generics feature
Embedded systems
Summary
Assessments
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Other Books You May Enjoy
Leave a review - let other readers know what you think
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Title Page
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset