On this page
  1. Send
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

Send

Prev: From | Up: builtins | Next: Sync
Rel: builtins, Ownership, Borrowing & Lifetimes
Ref: Rust Docs — Send
Tags: #public #prog #rust #builtins #tier/standard


Availability

Built-in / Prelude (Auto Marker Trait) — available with zero use imports.

Syntax & Overview

unsafe auto trait Send {}

Marks types safe to transfer ownership across OS thread boundaries.

Notes & Pitfalls

Example

use std::thread;

fn main() {
    let msg = String::from("moved to worker"); // String is Send
    let handle = thread::spawn(move || msg.len());
    assert_eq!(handle.join().unwrap(), 15);
}

Linked from

Related notes