Concurrency in Rust - Message Passing

Ғылым және технология

The ultimate Rust lang tutorial. Follow along as we go through the Rust lang book chapter by chapter.
📝 Get notified when the Rust Cheatsheet comes out: letsgetrusty.com/cheatsheet
The Rust book: doc.rust-lang.org/stable/book/​​
Chapters:
0:00​ Intro
0:38 Transfer Data Between Threads
5:54 Channels and Ownership Transference
6:43 Sending Multiple Values
7:46 Creating Multiple Producers
8:56 Outro
#letsgetrusty​​ #rust​lang​ #tutorial

Пікірлер: 35

  • @letsgetrusty
    @letsgetrusty2 жыл бұрын

    📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet

  • @dorktales254
    @dorktales2542 жыл бұрын

    I attribute my Rust knowledge to you my man, good work

  • @Cookiekeks
    @Cookiekeks Жыл бұрын

    I have wasted my entire sunday trying to figure out a solution to a problem. I started in the morning, and just now, at 1 am, I found your video which describes the perfect solution to my problem. Thank you so much!!

  • @scott3489
    @scott34892 жыл бұрын

    Thanks so much for this series. It's compliments the book well.

  • @erlangparasu6339
    @erlangparasu63392 жыл бұрын

    Great tutorial! Thank you so much

  • @herrxerex8484
    @herrxerex84842 жыл бұрын

    was waiting for this :]

  • @davidvernon3119
    @davidvernon3119 Жыл бұрын

    Totally dig the rubber ducky analogy!

  • @murugarajuperumalla5508
    @murugarajuperumalla55082 жыл бұрын

    Simple is better than complex, your explanation makes complex to simple. Keep it going Bogdan, let's get rusty :)

  • @aragonnetje

    @aragonnetje

    2 жыл бұрын

    Hey now, this isn't python XD

  • @shadowangel8005
    @shadowangel8005 Жыл бұрын

    So good, concurrently in rust is so powerful but allot to learn.

  • @Im_Ninooo
    @Im_Ninooo4 ай бұрын

    this is surprisingly simple

  • @raphaelmorgan2307
    @raphaelmorgan2307 Жыл бұрын

    "luckily for us, we get a compile time error!" 😆ik what you mean but it's funny out of context

  • @TheRedbeardster
    @TheRedbeardster2 жыл бұрын

    Excellent! don't you plan to demonstrate how to use message passing among several green threads(fibers) in Rust? It would be awesome! P.S. Спасибо :)

  • @johnwilliams7999
    @johnwilliams79992 жыл бұрын

    Nice explaination of channels

  • @736939
    @736939 Жыл бұрын

    What is the use case of the message passing? Can you show the examples?

  • @tux7k
    @tux7k2 жыл бұрын

    Is there a way to pass messages between modules?

  • @workflowinmind
    @workflowinmind2 жыл бұрын

    Do you have a video about rust async?

  • @leokiller123able
    @leokiller123able Жыл бұрын

    why doesn't rx get moved into the thread as well when we call thread::spawn(move...) ? and how could thread receive messages then

  • @azayakabaka3019
    @azayakabaka30192 жыл бұрын

    Any good tips for a single producer, multi consumer architecture? I've got a stream I'd like multiple subscribers in different threads to be able to read from.

  • @DjHeely

    @DjHeely

    2 жыл бұрын

    See the tokio broadcast module

  • @cvspvr

    @cvspvr

    Жыл бұрын

    use the flume crate for a mpmc channel

  • @adrian_sp6def
    @adrian_sp6def4 ай бұрын

    What if I want single producer and multiple receiver? Is a way that only one "free" receriver gets signal? I like to have an architecture like boss and workers.

  • @kishanbsh
    @kishanbsh2 жыл бұрын

    Will you be covering async await ?

  • @letsgetrusty

    @letsgetrusty

    2 жыл бұрын

    In the future yes! no pun intended

  • @eduardrivas6964

    @eduardrivas6964

    2 жыл бұрын

    @@letsgetrusty LOL

  • @rebekahwaterbury
    @rebekahwaterbury4 ай бұрын

    I'm confused about how clone() works in this context. What happens to the channel when the spawned threads processing, that owns the original tx, is completed? How does the receiver know that there is a cloned sender still out there and that the channel should stay open?

  • @clubpenguinfan1928

    @clubpenguinfan1928

    3 ай бұрын

    my naive guess is that each transmitter holds a reference to some internal part of the channel/receiver (e.g. to some message queue), so that it gets reference-counted behind the scenes. but yeah, honestly not sure if mspc channels are very fundamentally different from something like, say, an actual message queue behind an Arc

  • @bipinmaharjan4090
    @bipinmaharjan4090 Жыл бұрын

    Is this similar to golang channel?

  • @spongechameleon6940
    @spongechameleon69402 жыл бұрын

    At 7:30 is the "for received in rx {}" blocking?

  • @jabuci

    @jabuci

    Жыл бұрын

    yes, it's blocking

  • @amphibia95
    @amphibia952 жыл бұрын

    What?? Why would someone decide to shorten "receive" to "recv"?? It's only 7 letters like "channel" xD

  • @sohn7767

    @sohn7767

    2 жыл бұрын

    Rust likes to abbreviate that stuff. Mod, pub, etc. Surprised return isn’t called ret lol

  • @PhilippeCarphin

    @PhilippeCarphin

    Жыл бұрын

    I think it's a tradition thing in this particular case. Like the recv()/send() socket functions in the standard C library, or MPI_recv(), MPI_send().

  • @AsyncVoid
    @AsyncVoid2 жыл бұрын

    You need to stop posting videos so fast. I haven't been to the bathroom in days, my wife has left me and the food is running out.

  • @TroenderTass
    @TroenderTass2 жыл бұрын

    cloning variables and channels, seems horrible inefficient. How is rust performant. Seems like it is waisting plenty of memory.

Келесі