tiny-counter 0.1.0

Track event counts across time windows with fixed memory and fast queries
Documentation
# Examples

Cookbook-style examples demonstrating tiny-counter patterns. Each example is focused, runnable, and teaches one main concept.

## Quick Start

Run any example with:
```bash
cargo run --example <name>
```

## Core Examples (Getting Started)

**basic.rs** - First steps
- Create EventStore, record events, query time windows
- Uses plain strings (quickest way to start)
```bash
cargo run --example basic
```

**type_safety.rs** - Production pattern
- Define event enums for compile-time safety
- Avoid typos with IDE autocomplete
- The pattern all other examples follow
```bash
cargo run --example type_safety
```

**persistence.rs** - Storage backends
- MemoryStorage, FilePerEvent, SQLite
- Bincode vs JSON formats
- Dirty tracking and cleanup
```bash
cargo run --example persistence
cargo run --example persistence --features storage-fs,serde-json
```

## Use Case Examples

**rate_limiting.rs** - API throttling
- Simple limits and burst protection
- Transactional reservations
- Prerequisites and cooldowns
```bash
cargo run --example rate_limiting
```

**analytics.rs** - User engagement
- DAU/WAU/MAU metrics
- Conversion rates and engagement scoring
- Activity classification
```bash
cargo run --example analytics
```

**multi_device.rs** - Offline sync
- Export/import patterns
- Conflict-free merging
- Bidirectional sync
```bash
cargo run --example multi_device
```

**resource_tracking.rs** - Resource management
- Track open/closed connections
- Enforce capacity limits
- Calculate current state with deltas
```bash
cargo run --example resource_tracking
```

**security.rs** - Attack prevention
- Brute force protection
- Progressive backoff
- Anomaly detection
```bash
cargo run --example security
```

**concurrent.rs** - Thread safety
- Record from multiple threads
- Query from separate threads
- Concurrent rate limiting
```bash
cargo run --example concurrent
```

## Optional Feature Examples

**async_autopersist.rs** - Async patterns (requires tokio)
- Background auto-persistence
- Async workflow integration
- Graceful shutdown
```bash
cargo run --example async_autopersist --features tokio,serde
```

## Example Structure

Each example:
- Runs standalone
- Uses features only when required
- Has clear doc comments
- Shows output for verification
- Stays under 200 lines when possible

## Pattern Progression

1. **Quick start** (`basic`) - Strings, simple API, immediate value
2. **Production** (`type_safety`) - Enums, compile-time safety
3. **Real use cases** - Domain enums, practical patterns