---
title: Penaltybox
summary: A penaltybox that can be used with the edge rate limiter or stand alone for adding and checking if some entry is in the data set.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/erl/struct.Penaltybox/
---

**Kind:** Struct  
**Module:** [erl](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/erl/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/erl.rs#54

```rust
pub struct Penaltybox { /* private fields */ }
```

A penaltybox that can be used with the edge rate limiter or stand alone for adding and checking if some entry is in the data set.

## Methods

### add

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/erl.rs#123

```rust
fn add(&self, entry: &str, ttl: Duration) -> Result<(), ERLError>
```

Add entry to a the penaltybox for the duration of ttl.
Valid ttl span is 1m to 1h and TTL value is truncated to the nearest minute.

**Parameters**

- `self`: `&Self`
- `entry`: `&str`
- `ttl`: `Duration`

**Returns**

`Result<(), ERLError>`

### has

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/erl.rs#129

```rust
fn has(&self, entry: &str) -> Result<bool, ERLError>
```

Check if entry is in the penaltybox.

**Parameters**

- `self`: `&Self`
- `entry`: `&str`

**Returns**

`Result<bool, ERLError>`

### open

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/erl.rs#114

```rust
fn open(penaltybox_name: &str) -> Self
```

Open a Penaltybox identified by the given name.

**Parameters**

- `penaltybox_name`: `&str`

**Returns**

`Self`

## Auto trait implementations

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `Downcast`
- `DowncastSync`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `TryFrom<U>`
- `TryInto<U>`
