value-extra 0.1.1

A tri-state Patch<T> type for partial update semantics — distinguishing between 'has value', 'absent', and 'explicitly null'
Documentation
# value-extra

[![Crates.io](https://img.shields.io/crates/v/value-extra.svg)](https://crates.io/crates/value-extra)
[![Documentation](https://docs.rs/value-extra/badge.svg)](https://docs.rs/value-extra)
[![License](https://img.shields.io/crates/l/value-extra.svg)](LICENSE)
[![CI](https://github.com/itsfoxstudio/value-extra/actions/workflows/ci.yml/badge.svg)](https://github.com/itsfoxstudio/value-extra/actions/workflows/ci.yml)

Extended value types for Rust — practical primitives beyond the standard library.

## Installation

```toml
[dependencies]
value-extra = "0.1"

# With serde support
value-extra = { version = "0.1", features = ["serde"] }
```

## Types

### `Patch<T>`

A tri-state type for partial update semantics — distinguishing between "has value", "absent", and "explicitly null".

#### The Problem

When handling partial updates (PATCH requests, config merging, etc.), `Option<T>` conflates two distinct states:

- **Field is absent** → don't touch the existing value
- **Field is explicitly null** → clear/reset the value

#### The Solution

`Patch<T>` provides three states:

| JSON Input | Patch State | Meaning |
|------------|-------------|---------|
| `{ "name": "Alice" }` | `Patch::Some("Alice")` | Set to value |
| `{ "name": null }` | `Patch::None` | Explicitly clear |
| `{ }` | `Patch::Empty` | Leave unchanged |

```rust
use value_extra::Patch;

fn apply_name_patch(current: &mut Option<String>, patch: Patch<String>) {
    match patch {
        Patch::Some(new) => *current = Some(new),
        Patch::None => *current = None,  // explicitly clear
        Patch::Empty => {}               // no change
    }
}
```

#### Features

- **Option-like API**`map`, `and_then`, `unwrap_or`, `filter`, `zip`, and more
- **Serde support** — feature-gated serialization with tri-state JSON handling
- **no_std compatible** — works in embedded and WASM environments

See the [full documentation](https://docs.rs/value-extra) for API details and serde usage examples.

## License

MIT — see [LICENSE](LICENSE) for details.