Part of the Rust Crash Course: https://www.youtube.com/playlist?list=PL6yRaaP0WPkWRsXJgdnw9lj1vchAaKwfS
Welcome to the Rust Crash Course
In this course, we will be learning Rust from scratch. This course is very fast paced and designed for programmers who already have some experience with another programming language such as Dart or JavaScript or Swift. We will talk about variables, constants, ownership, functions, structures, enumerations, collections such as tuples, vectors, hash-maps and iterators, optionals, error handling, lifetime specifiers, traits, pointers, generics, packages, crates, modules and paths, asynchronous programming and we will also create 2 sample applications using Rust to put all these concepts to use!
Rust allows modern asynchronous programming with async/await. In this chapter we will explore some of the asynchronous runtimes for Rust and how we can leverage their power to write modern async apps in Rust.
Timestamps:
00:00 - Asynchronous Rust
00:15 - Rust supports async/await like many other languages
01:03 - Let's write an async function
01:37 - Call the function in main()
02:51 - Let's fix the error
04:51 - Await on the "get_name()" function
05:55 - You can use the ".await" syntax on async functions
06:37 - Include "tokio" in your Cargo.toml
07:40 - Import required headers
08:07 - Write the first asynchronous function header
08:32 - Sleep in the function
09:35 - Return a value from the function
09:47 - Create a second similar function
10:23 - Turn your main function to a tokio main function
10:56 - Turn your main function into an async function
11:04 - Call the first API and print its result out
11:34 - Do the same thing with the second API
11:50 - At the moment API 1 blocks API 2
12:34 - Async functions don't have to use "async fn"
13:33 - Import the Future trait
13:49 - Change your function signature
14:20 - Add your function code into "async"
15:06 - The call-site remains the same
15:23 - Lifetime of variables returned by Future
16:06 - Bundle your variables inside async { ... }
16:38 - Asynchronous functions can move variables
17:02 - Let's see an example of async move
17:23 - Create a local String variable
17:36 - Return the local variable inside an async move
19:02 - Asynchronous programming is a big topic
If you want to support my work, please consider joining my YouTube channel by pressing the Join button!
Twitter: https://twitter.com/vandadnp
LinkedIn: https://linkedin.com/in/vandadnp
Let's get started!