Async functions in traits finally here!

preview_player
Показать описание
Rust recently added support for asynchronous tasks inside a trait. This is a big news in the Rust world. Join me in today's video as I cover the newly implemented feature of async functions inside traits on the nightly version of rust.

Chapters:
0:00 Async/Await syntax
0:33 The problem
1:30 Workaround
2:00 Nightly support
2:32 Limitations
3:16 Path to stabilization
Рекомендации по теме
Комментарии
Автор

📝Get your *FREE Rust cheat sheet* :

Correction: The second limitation of this new nightly feature is that you can not spawn *from* a generic function while using a work stealing executor that requires spawned tasks to be Send. Note that the Rust team thinks this situation will be uncommon.

letsgetrusty
Автор

GAT -> async trait, the Rust team always has a super clear and steady path. I've never seen a team that ships software like this, especially in those "best FE framework" variety shows.

zhehuizhou
Автор

baremetal embedded programmer here: we avoid std lib BECAUSE of heap allocation.
Managing the heap is a pain, while having all in stack and static and without using recursive function, means we know ram and stack usage at compile time, and guarantee no leaks even on C/C++.
Very important for devices the MUST work, sometimes for years between reboot

lesto
Автор

the video is great, but was the clickbait necessary? why not put more information in the title and thumbnail so we know what the video is about before entering it?

jvcmarc
Автор

Correction: the async-trait macro is fully compatible with no_std

greentea
Автор

Nice. I literally was frustrated that I couldn’t do this last night

asagex
Автор

I really like your explanation of GATs and why they're useful (particularly in async!), desugaring the async keyword and showing current workarounds makes it a lot more obvious why we needed them. Great stuff

oxey_
Автор

"I don't know what you just said little kid. But you special man. You reached out...and you touched a brother's heart..."

ufedmariupol
Автор

That main difference is so huge that I would not really compare it to JS as it makes for quite a different developer experience.

tvujtatata
Автор

1:51 im using async_trait in my embedded application (a basic command line OS) and it works fine without the standard library, but yeah the heap allocation part is necessary so you need to implement an allocator for it

fantasypvp
Автор

can you dispatch dynamically now a trait that has an async function?

mihai.craita
Автор

I currently have an async function on &self.
I want to spawn a bunch of threads and execute this function multiple times simultaneously (no mutability needed).
However, as you said Future does not implement Send (I don't even care about the result of the function, but since futures are lazy I need to do &self.function().await.
What would can I do about it?

youtubepooppismo
Автор

Can we have a tutorial about backend with DB and rest middle ware implementations please!

skytech
Автор

Holy shit, Fast Show reference 7 seconds in!

alexclark
Автор

why is it always when i watch videos about programming i get confused before completely losing my understandment and my head feels dizzy?

vadiks
Автор

Your cheat sheet is not being delivered to my email... Can you look at that?

jaroslavhuss
Автор

I wish trait containing async functions was object safe

dogik
Автор

I would say "similar to F#/C#" rather than "similar to JavaScript", as async/await was firstly a construct of C#(actually it started in F# and was only later ported to C#)***, but very good video!

diadetediotedio
Автор

Introducing incomplete nightly feature to your audience is a very questionable move. And to people watching this video. Don't use it in any serious project unless you have the time to debug and report ICE. as well as be prepared for nightly breaking changes that can render your code not compilable.

realsong-fake
Автор

The animated background is very distracting!

PaulSebastianM