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

# Guardrail Result • Rust AI Agent SDK

> GuardrailResult: Result of a guardrail validation.

# GuardrailResult

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

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

Result of a guardrail validation.

## Fields

| Name       | Type                   | Description                                      |
| ---------- | ---------------------- | ------------------------------------------------ |
| `success`  | `bool`                 | Whether the guardrail check passed               |
| `result`   | `Option&lt;String&gt;` | The result if modified, or original if unchanged |
| `error`    | `String`               | Error message if validation failed               |
| `metadata` | `HashMap&lt;String`    | Additional metadata                              |

## Methods

### `success`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn success(result: impl Into<String>) -> Self
```

Create a successful result

**Parameters:**

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

### `pass`

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

Create a successful result without modification

### `failure`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn failure(error: impl Into<String>) -> Self
```

Create a failed result

**Parameters:**

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

### `from_tuple`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn from_tuple(success: bool, data: impl Into<String>) -> Self
```

Create from a tuple (success, result\_or\_error)

**Parameters:**

| Name      | Type                      |
| --------- | ------------------------- |
| `success` | `bool`                    |
| `data`    | `impl Into&lt;String&gt;` |

### `with_metadata`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
```

Add metadata

**Parameters:**

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

### `is_success`

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

Check if passed

### `is_failure`

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

Check if failed

### `get_result_or`

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

Get the result or original content

**Parameters:**

| Name       | Type   |
| ---------- | ------ |
| `original` | `&str` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/guardrails/mod.rs#L38">
  `praisonai/src/guardrails/mod.rs` at line 38
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Guardrails" icon="shield" href="/docs/rust/guardrails" />

  <Card title="Rust Approval" icon="check" href="/docs/rust/approval" />

  <Card title="Rust Security" icon="lock" href="/docs/rust/security" />
</CardGroup>
