# caeryn
Small protected runtime core with isolated execution contexts.
## Purpose
`caeryn` (from Welsh *caer*, a fortified enclosure) provides a minimal
runtime for managing isolated execution contexts. Each context has its own
state, counters, output, and guard status — like rooms in a fortress.
## Features
- **Isolated contexts** — each context has independent state and counters
- **Task queue** — submit tasks and run them in batch
- **Guard system** — pause or stop individual contexts
- **Event log** — track spawns and lifecycle events
- **Zero dependencies**
## Install
```bash
cargo add caeryn
```
## Usage
```rust
use caeryn::{Runtime, Task};
let mut rt = Runtime::new();
let ctx = rt.spawn("worker");
rt.submit(ctx, Task::SetState("role".into(), "builder".into())).unwrap();
rt.submit(ctx, Task::Increment("tasks_done".into())).unwrap();
rt.submit(ctx, Task::Echo("job finished".into())).unwrap();
rt.run_all();
let c = rt.context(ctx).unwrap();
assert_eq!(c.state("role"), Some("builder"));
assert_eq!(c.counter("tasks_done"), 1);
```
## License
MIT OR Apache-2.0