---
source: https://iinventedlight.com/library/notes/rust-threads-message-passing.md
title: "Threads and message passing in Rust"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (rust-lang/book and cited companions); prose restates cited source lines in own words"
license_family: rust-mit
attribution: "Summary by iinventedlight (AI-assisted). Sources: Rust book + Rust by Example Channels page (MIT OR Apache-2.0). Notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
approved_by: "Cole Withington, 2026-11-09 13:40 PT: \"Yes, publish all 15 Rust drafts\""
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No Rust code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-systems: Rust concurrency"
tags: [rust, threads, channels, concurrency]
client: Librarian
sources:
  - id: S1
    title: "Using Threads to Run Code Simultaneously"
    publisher: The Rust Project (The Rust Programming Language book)
    url: https://doc.rust-lang.org/book/ch16-01-threads.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "Using Message Passing to Transfer Data Between Threads"
    publisher: The Rust Project (The Rust Programming Language book)
    url: https://doc.rust-lang.org/book/ch16-02-message-passing.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
  - id: S3
    title: "Channels - Rust By Example"
    publisher: Rust by Example (rust-lang/rust-by-example)
    url: https://doc.rust-lang.org/rust-by-example/std_misc/channels.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
---
# Threads and message passing in Rust

**Answer:** Spawn work with `thread::spawn` and a closure. Channels split into a transmitter half and a receiver half.

## Ownership across threads

Use `move` so the closure owns the values it captures. Message passing moves values between threads by transferring ownership through the channel.

Channels give a unidirectional flow between a Sender and a Receiver.

## Claims

- id: C1
  claim: thread::spawn creates a new thread with a closure.
  source: S1
  evidence: "To create a new thread, we call the thread::spawn function and pass it a closure"
- id: C2
  claim: Use move so the closure takes ownership of captured values.
  source: S1
  evidence: "we force the closure to take ownership of the values it's using rather than allowing"
- id: C3
  claim: A channel has a transmitter half and a receiver half.
  source: S2
  evidence: "A channel has two halves: a transmitter and a receiver."

- id: C4
  claim: Rust provides asynchronous channels for communication between threads.
  source: S3
  evidence: "Rust provides asynchronous channels for communication between threads."

## Sources

- [S1] Using Threads to Run Code Simultaneously. The Rust Project (The Rust Programming Language book). https://doc.rust-lang.org/book/ch16-01-threads.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.
- [S2] Using Message Passing to Transfer Data Between Threads. The Rust Project (The Rust Programming Language book). https://doc.rust-lang.org/book/ch16-02-message-passing.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.

- [S3] Channels - Rust By Example. Rust by Example (rust-lang/rust-by-example). https://doc.rust-lang.org/rust-by-example/std_misc/channels.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
