How to Use std

:marker Traits (Send, Sync, Copy, Sized)

std::marker traits like Send, Sync, Copy, and Sized define how Rust types handle concurrency, duplication, and memory sizing.

Use std::marker traits to define concurrency and memory behavior for your types: Send allows moving ownership across threads, Sync allows shared references across threads, Copy enables zero-cost duplication, and Sized ensures the type has a known size at compile time.

use std::marker::{Send, Sync, Copy, Sized};

// Example: A type that is safe to send between threads but not share
struct ThreadSafeData {
    value: i32,
}

impl Send for ThreadSafeData {}
// Note: Sync is not implemented, so &ThreadSafeData cannot be shared

// Example: A type that can be copied like a primitive
#[derive(Copy, Clone)]
struct CopyableData {
    x: i32,
    y: i32,
}

// Example: A type that must have a known size
fn process<T: Sized>(data: T) {
    // ...
}