Category: Programming Languages
-
Rust 101 – 46: Exercises for module F (q1)
Coding up a linked list based on raw pointers in Rust. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async, Unsafe This section (Async): 42: Why unsafe?, 43: Meaning of unsafe, 44: Undefined behaviour, 45: Unsafe types, 46: Exercise 1 Links: Slides: Rust 101 – module F Exercises: … Continue reading Rust 101 – 46: Exercises for module F (q1)
-
Rust 101 – 45: Unsafe types and examples
Looking through some of the types of code you will be working with if you’re doing unsafe Rust, and some of the unsafe types you might want to use. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async, Unsafe This section (Async): 42: Why unsafe?, 43: Meaning of … Continue reading Rust 101 – 45: Unsafe types and examples
-
Rust 101 – 44: Undefined behaviour
If you write unsafe Rust, you need to reason about “undefined behaviour”. We talk through what that means, and try to develop an intuition about why we can’t predict how our program will behave if we don’t follow the rules. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, … Continue reading Rust 101 – 44: Undefined behaviour
-
Rust 101 – 43: The two meanings of “unsafe” in Rust
The `unsafe` keyword in Rust means two things: “You must read the docs!” or “I promise I read the docs and followed the rules!”. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async, Unsafe This section (Async): 42: Why unsafe?, 43: Meaning of unsafe Links: Slides: Rust 101 … Continue reading Rust 101 – 43: The two meanings of “unsafe” in Rust
-
Rust 101 – 42: Why do we need unsafe?
There is a special mode in Rust programs called unsafe – why do we need it? Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async, Unsafe This section (Async): 42: Why unsafe? Links: Slides: Rust 101 – module F Exercises: artificialworlds.net/presentations/rust-101/exercises/F-safe-unsafe/mod.html The course materials for this series are … Continue reading Rust 101 – 42: Why do we need unsafe?
-
Rust 101 – 41: Exercises for module E (q2b)
Writing a mini client to connect to our async Rust chat server. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b Links: Slides: … Continue reading Rust 101 – 41: Exercises for module E (q2b)
-
Rust 101 – 40: Exercises for module E (q2a)
Writing a little chat server in async Rust. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b Links: Slides: Rust 101 – module … Continue reading Rust 101 – 40: Exercises for module E (q2a)
-
Rust 101 – 39: Exercises for module E (q1b)
Writing a one-shot queue using async Rust, this time with a little less help. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b … Continue reading Rust 101 – 39: Exercises for module E (q1b)
-
Rust 101 – 38: Exercises for module E (q1a)
Writing our own multi-producer-single-consumer (MPSC) queue using async Rust. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b Links: Slides: Rust 101 – … Continue reading Rust 101 – 38: Exercises for module E (q1a)
-
Rust 101 – 37: Async runtimes
We talked about how Futures have poll methods, but who calls them? That is the job of the runtime. We talk about how to launch your async code and how to choose the right runtime, and then we have a very brief look at some Web frameworks that are based on async Rust. Series: Language … Continue reading Rust 101 – 37: Async runtimes
-
Rust 101 – 36: What async and await really do
Attempting to explain as slowly as possible what actually happens when the compiler finds an async function containing awaits: it writes a poll method for you to create something that implements Future. The generated poll method polls the Futures you asked to await, in order. The interesting bit is that this generated thing that implements … Continue reading Rust 101 – 36: What async and await really do
-
Rust 101 – 35: Futures
Exploring what a Future is in async Rust and how we could manually write code that polls futures. Normally, we avoid this manual work by using the `async` and `await` keywords, but looking into this helps us understand what those keywords really do. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and … Continue reading Rust 101 – 35: Futures
-
Rust 101 – 34: What is async?
What async programming is and what it looks like in Rust. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b Links: Slides: Rust … Continue reading Rust 101 – 34: What is async?
-
Rust 101 – 33: Exercises for module D (q3)
Following through an exercise using a trait object with dynamic dispatch to choose different behaviour at runtime. Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async This section (Trait objects): 28: Dynamic dispatch, 29: Object safety, 30: Patterns, 31: Exercise D1, 32: Exercise D2, 33: Exercise D3 Links: … Continue reading Rust 101 – 33: Exercises for module D (q3)