Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Channels and Message Passing | Rust Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Rust Fundamentals

Lesson 36 of 50

·rust

Channels and Message Passing

15 minutes

Course progress72%

Channels and Message Passing

std::sync::mpsc provides multi‑producer, single‑consumer channels.

use std::sync::mpsc;
use std::thread;

fn main() {
    let (tx, rx) = mpsc::channel();
    thread::spawn( || {
          = \
move
let
data
"Hello from thread\"; tx.send(data).unwrap(); }); let received = rx.recv().unwrap(); println!(\"Received: {}\", received); }
Make it stickPractice what you've learned1 quiz · 1 practical test · Optional activities from Rust FundamentalsBrowse activities
Previous lessonThreads and ConcurrencyContinue to lesson 37Mutexes and Shared StateBack to Rust Fundamentals curriculum