---
title: Dictionary
summary: A Compute Dictionary.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/struct.Dictionary/
---

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

> **DEPRECATED:** renamed to `ConfigStore`

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

A Compute Dictionary.

## Methods

### contains

**Flags:** deprecated  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/dictionary.rs#149

> **DEPRECATED:** use method on `ConfigStore` instead

```rust
fn contains(&self, key: &str) -> bool
```

Return true if the dictionary contains an entry with the given key.

#### Examples

```rust
assert!(dictionary.contains("key"));
```

#### Panics

This may panic for any of the reasons that [`Dictionary::try_get`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/dictionary/struct.Dictionary/#method-try_get) would return an error.

**Parameters**

- `self`: `&Self`
- `key`: `&str`

**Returns**

`bool`

### get

**Flags:** deprecated  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/dictionary.rs#99

> **DEPRECATED:** use method on `ConfigStore` instead

```rust
fn get(&self, key: &str) -> Option<String>
```

Lookup a value in this dictionary.

If successful, this function returns `Some(_)` if an entry was found, or `None` if no entry
with the given key was found.

#### Examples

```rust
assert_eq!(
     dictionary.get("bread"),
     Some(String::from("a usually baked and leavened food")),
);
assert_eq!(
    dictionary.get("freedom"),
    Some(String::from("the absence of necessity, coercion, or constraint")),
);

// Otherwise, `get` will return nothing.
assert!(dictionary.get("zzzzz").is_none());
```

#### Panics

This may panic for any of the reasons that [`Dictionary::try_get`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/dictionary/struct.Dictionary/#method-try_get) would return an error.

**Parameters**

- `self`: `&Self`
- `key`: `&str`

**Returns**

`Option<String>`

### open

**Flags:** deprecated  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/dictionary.rs#40

> **DEPRECATED:** use method on `ConfigStore` instead

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

Open a dictionary, given its name.

#### Examples

```rust
let merriam = Dictionary::open("merriam webster");
let oed = Dictionary::open("oxford english dictionary");
```

**Parameters**

- `name`: `&str`

**Returns**

`Self`

### try_get

**Flags:** deprecated  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/dictionary.rs#130

> **DEPRECATED:** use method on `ConfigStore` instead

```rust
fn try_get(&self, key: &str) -> Result<Option<String>, LookupError>
```

Try to lookup a value in this dictionary.

If successful, this function returns `Ok(Some(_))` if an entry was found, or `Ok(None)` if
no entry with the given key was found. This function returns `Err(_)` if the lookup failed.

#### Examples

```rust
assert_eq!(
     dictionary.try_get("bread")?,
     Some(String::from("a usually baked and leavened food")),
);
assert_eq!(
    dictionary.try_get("freedom")?,
    Some(String::from("the absence of necessity, coercion, or constraint")),
);

// Otherwise, `try_get` will return nothing.
assert!(dictionary.try_get("zzzzz")?.is_none());
Ok(()) }
```

**Parameters**

- `self`: `&Self`
- `key`: `&str`

**Returns**

`Result<Option<String>, LookupError>`

### try_open

**Flags:** deprecated  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/dictionary.rs#67

> **DEPRECATED:** use method on `ConfigStore` instead

```rust
fn try_open(name: &str) -> Result<Self, OpenError>
```

Try to open a dictionary, given its name.

#### Examples

```rust
let merriam = Dictionary::try_open("merriam webster")?;
```

**Parameters**

- `name`: `&str`

**Returns**

`Result<Self, OpenError>`

## 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>`
