> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Fast Context • Rust AI Agent SDK

> FastContext: Fast context for efficient context management

# FastContext

> Defined in the [**specialized**](../modules/specialized) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Fast context for efficient context management

## Fields

| Name           | Type                | Description                |
| -------------- | ------------------- | -------------------------- |
| `entries`      | `Vec&lt;String&gt;` | Context entries            |
| `max_size`     | `usize`             | Maximum size in characters |
| `current_size` | `usize`             | Current size               |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new(max_size: usize) -> Self
```

Create a new fast context

**Parameters:**

| Name       | Type    |
| ---------- | ------- |
| `max_size` | `usize` |

### `add`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn add(&mut self, content: impl Into<String>) -> ()
```

Add content to context

**Parameters:**

| Name      | Type                      |
| --------- | ------------------------- |
| `content` | `impl Into&lt;String&gt;` |

### `get`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get(&self) -> &[String]
```

Get all context

### `as_string`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn as_string(&self) -> String
```

Get context as single string

### `clear`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn clear(&mut self) -> ()
```

Clear context

### `size`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn size(&self) -> usize
```

Get current size

### `is_empty`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_empty(&self) -> bool
```

Check if empty

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/specialized.rs#L279">
  `praisonai/src/parity/specialized.rs` at line 279
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Context Management" icon="layer-group" href="/docs/rust/context-management" />

  <Card title="Rust Token Management" icon="coins" href="/docs/rust/token-management" />
</CardGroup>
