# Quick Start

## Add to your project

```toml
[dependencies]
redline = "0.1"
```

## Annotate a function

```rust
use redline::redline;

#[redline(allocs = 0)]
fn hot_path(a: f64, b: f64) -> f64 {
    a * a + b * b
}
```

Compile. If `hot_path` allocates, the compiler rejects it.

## Try breaking it

```rust
#[redline(allocs = 0)]
fn broken() -> String {
    String::from("oops")  // won't compile
}
```

```
error: redline: function `broken` has 1 allocation(s), limit is 0
```

## Multiple constraints

```rust
#[redline(latency = "< 100us", allocs = 0, syscalls = 0)]
fn critical_section(data: &[u8]) -> u64 {
    let mut h: u64 = 0;
    for i in 0..64 {
        h ^= data.get(i).copied().unwrap_or(0) as u64;
    }
    h
}
```

Every constraint is checked independently. All must pass.
