What is Send and Sync

Send and Sync are Rust traits that ensure types can be safely moved to or shared between threads.

Send and Sync are marker traits in Rust that determine if a type can be safely transferred between threads or shared across threads. Send means a type can be moved to another thread, while Sync means a reference to the type can be safely shared between threads. Most standard types implement these automatically, but you must explicitly implement them for custom types used in concurrency.

use std::thread;

fn main() {
    let data = String::from("hello");
    thread::spawn(move || {
        println!("{}", data);
    }).join().unwrap();
}