2024-Konkuk-Rust-Roguelike is the material(lecture notes, examples and assignments) repository for learning Rust programming language and making a simple console Roguelike game at Konkuk University Google Developer Student Clubs (GDSC) and Game Development Club 'EDGE' in 2024 Spring.
- 2024-10-03: Added new contents for lecture "Closures" and renewed Assignment #6 and its solution.
- 2024-10-10: Added new contents for lecture "Macros" and renewed Assignment #7 and its solution.
- Week 0 (3/12) [Lecture]
- Introduction
- Week 1 (3/26) [Assignment] [Solution]
- Hello, World
- What is Rust?
- Benefits of Rust
- Playground
- Types and Values
- Hello, World
- Variables
- Values
- Arithmetic
- Type Inference
- Control Flow Basics
if
Expressions- Loops
break
andcontinue
- Blocks and Scopes
- Functions
- Macros
- Tuples and Arrays
- Arrays
- Tuples
- Array Iteration
- Patterns and Destructuring
- References
- Shared References
- Exclusive References
- Slices:
&[T]
- Strings
- Assignment #1
- Hello, World
- Week 2 (4/9) [Assignment] [Solution]
- User-Defined Types
- Named Structs
- Tuple Structs
- Enums
- Static
- Const
- Type Aliases
- Pattern Matching
- Matching Values
- Destructuring
- Let Control Flow
- Methods and Traits
- Methods
- Traits
- Deriving
- Assignment #2
- User-Defined Types
- Week 3 (5/7) [Assignment] [Solution]
- Generics
- Generic Functions
- Generic Data Types
- Generic Traits
impl
Trait
- Standard Library Types
- Standard Library
- Documentation
Option
Result
String
Vec
HashMap
- Standard Library Traits
- Comparisons
- Operators
From
andInto
- Casting
Read
andWrite
Default
, struct update syntax- Closures
- Assignment #3
- Generics
- Week 4 (5/21) [Assignment] [Solution]
- Memory Management
- Review of Program Memory
- Approaches to Memory Management
- Onwership
- Move Semantics
Clone
Copy
TypesDrop
- Smart Pointers
Box
Rc
- Trait Objects
- Borrowing
- Borrowing a Value
- Borrow Checking
- Interior Mutability
- Lifetimes
- Lifetime Annotations
- Lifetime Elision
- Struct Lifetimes
- Assignment #4
- Memory Management
- Week 5 (6/4) [Assignment] [Solution]
- Iterators
Iterator
IntoIterator
FromIterator
- Modules
- Modules
- Filesystem Hierarchy
- Visibility
use
,super
,self
- Testing
- Test Modules
- Other Types of Tests
- Compiler Lints and Clippy
- Error Handling
- Panics
- Try Operator
- Try Conversions
Error
Traitthiserror
andanyhow
- Unsafe Rust
- Unsafe
- Dereferencing Raw Pointers
- Mutable Static Variables
- Unions
- Unsafe Functions
- Unsafe Traits
- Assignment #5
- Iterators
- Week 6 (7/4) [Lecture] [Example] [Assignment] [Solution]
- Closures
- Capturing Variables
- Closures that Borrow
- Closures that Steal
- Function and Closure Types
- Closure Performance
- Closures and Safety
- Closures that Kill
FnOnce
FnMut
Copy
andClone
for Closures
- Callbacks
- Using Closures Effectively
- Capturing Variables
- Assignment #6
- Closures
- Week 7 (7/11) [Lecture] [Example] [Assignment] [Solution]
- Macros
- Macro Basics
- Basics of Macro Expansion
- Unintended Consequences
- Repetition
- Built-in Macros
- Debugging Macros
- Building the
json!
Macro- Fragment Types
- Recursion in Macros
- Using Traits with Macros
- Scoping and Hygiene
- Importing and Exporting Macros
- Avoiding Syntax Errors During Matching
- Beyond macro_rules!
- Macro Basics
- Assignment #7
- Macros
- Week 8 (7/25) [Lecture] [Example] [Assignment] [Solution]
- Concurrency, Part 1
- Fork-Join Parallelism
spawn
andjoin
- Error Handling Across Threads
- Sharing Immutable Data Across Threads
Rayon
- Channels
- Sending Values
- Receiving Values
- Running the Pipeline
- Channel Features and Performance
- Thread Safety:
Send
andSync
- Piping Almost Any Iterator to a Channel
- Beyond Pipelines
- Fork-Join Parallelism
- Assignment #8
- Concurrency, Part 1
- Week 9 (8/2) [Lecture] [Assignment] [Solution]
- Concurrency, Part 2
- Shared Mutable State
- What Is a Mutex?
Mutex<T>
mut
andMutex
- Why Mutexes Are Not Always a Good Idea
- Deadlock
- Poisoned Mutexes
- Multiconsumer Channels Using Mutexes
- Read/Write Locks (
RwLock<T>
) - Condition Variables (
Condvar
) - Atomics
- Global Variables
- Shared Mutable State
- Assignment #9
- Concurrency, Part 2
- Week 10 (8/8) [Lecture]
- Asynchronous Programming, Part 1
- From Synchronous to Asynchronous
- Futures
- Async Functions and Await Expressions
- Calling Async Functions from Synchronous Code:
block_on
- Spawning Async Tasks
- Async Blocks
- Building Async Functions from Async Blocks
- Spawning Async Tasks on a Thread Pool
- From Synchronous to Asynchronous
- Asynchronous Programming, Part 1
- Week 11 (8/15) [Lecture] [Example]
- Asynchronous Programming, Part 2
- From Synchronous to Asynchronous
- But Does Your Future Implement
Send
? - Long Running Computations:
yield_now
andspawn_blocking
- Comparing Asynchronous Designs
- A Real Asynchronous HTTP Client
- But Does Your Future Implement
- An Asynchronous Client and Server
- Error and Result Types
- The Protocol
- Talking User Input: Asynchronous Streams
- Sending Packets
- Receving Packets: More Asynchronous Streams
- The Client's Main Function
- From Synchronous to Asynchronous
- Asynchronous Programming, Part 2
- Week 12 (8/22) [Lecture] [Example]
- Asynchronous Programming, Part 3
- An Asynchronous Client and Server
- The Server's Main Function
- Handling Chat Connections: Async Mutexes
- The Group Table: Synchronous Mutexes
- Chat Groups:
tokio
's Broadcast Channels
- Primitive Futures and Executors: When Is a Future Worth Polling Again?
- An Asynchronous Client and Server
- Asynchronous Programming, Part 3
- Week 13 (9/29) [Lecture] [Example]
- Asynchronous Programming, Part 4
- Primitive Futures and Executors: When Is a Future Worth Polling Again?
- Invoking Wakers:
spawn_blocking
- Implementing
block_on
- Invoking Wakers:
- Pinning
- The Two Life Stages of a Future
- Pinned Pointers
- The
Unpin
- When Is Asynchronous Code Helpful?
- Primitive Futures and Executors: When Is a Future Worth Polling Again?
- Assignment #10
- Asynchronous Programming, Part 4
- Week 14 (TBA)
- Foreign Function Interface (FFI)
- Rust and WebAssembly
- Assignment #11
- Beginner
- Intermediate
- Advanced
Contributions are always welcome, either reporting issues/bugs or forking the repository and then issuing pull requests when you have completed some additional coding that you feel will be beneficial to the main project. If you are interested in contributing in a more dedicated capacity, then please contact me.
You can contact me via e-mail (utilForever at gmail.com). I am always happy to answer questions or help with any issues you might have, and please be sure to share any additional work or your creations with me, I love seeing what other people are making.
The class is licensed under the MIT License:
Copyright © 2024 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.