send_cells 0.2.0

Safe and unsafe cells implementing Send/Sync
Documentation
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build and Test Commands

```bash
# Build the project
cargo build

# Run tests
cargo test

# Run a single test
cargo test test_name

# Build documentation
cargo doc --open

# Check code without building
cargo check

# Format code
cargo fmt

# Run linter
cargo clippy
```

## Architecture Overview

`send_cells` is a Rust library that provides cell types for safely sending and sharing non-Send/non-Sync types across thread boundaries. The library has two main categories:

### Safe Wrappers (Runtime-Checked)
- **`SendCell<T>`** (`src/send_cell.rs`): Wraps non-Send types with runtime thread checking. Panics if accessed from wrong thread.
- **`SyncCell<T>`** (`src/sync_cell.rs`): Wraps non-Sync types with mutex-based synchronization for safe concurrent access.
- **`SendFuture<T>`** (`src/send_cell.rs`): Wraps non-Send futures with runtime thread checking.

### Unsafe Wrappers (Zero-Cost)
- **`UnsafeSendCell<T>`** (`src/unsafe_send_cell.rs`): No runtime checks, requires unsafe blocks for access.
- **`UnsafeSyncCell<T>`** (`src/unsafe_sync_cell.rs`): No runtime checks for Sync types.
- **`UnsafeSendFuture<T>`** (`src/unsafe_send_cell.rs`): No runtime checks for futures.

### Platform Support
- **`src/sys.rs`**: Platform-specific thread ID implementation
- Special support for `wasm32-unknown-unknown` with web workers via `wasm_thread` dependency

## Key Design Patterns

1. **Thread Safety Model**: Safe wrappers store the creation thread ID and check it on every access. Unsafe wrappers bypass these checks for performance.

2. **API Design**: 
   - Safe wrappers provide `get()`, `with()`, `with_mut()` methods
   - Unsafe wrappers require explicit `unsafe` blocks
   - All types implement `Send` and/or `Sync` as appropriate

3. **Error Handling**: Safe wrappers panic with descriptive messages when accessed from wrong thread. Include thread IDs in panic messages for debugging.

4. **Documentation**: Every module has comprehensive rustdoc comments with examples. Documentation emphasizes safety requirements and use cases.

## Development Notes

- This is a low-level concurrency library - safety is paramount
- All unsafe code must have clear SAFETY comments explaining invariants
- Tests should verify both correct usage and panic cases for wrong-thread access
- Consider platform differences, especially WASM support with web workers