1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! # guardrail-core
//!
//! Core types, pipeline, and stage trait for `guardrail-rs` — a zero-Python
//! LLM security proxy written in Rust.
//!
//! This crate contains no I/O and no async runtime. It is purely the data model
//! and the pipeline abstraction that all other crates build upon.
//!
//! ## Feature flags
//!
//! | Flag | Description | Default |
//! |------|-------------|---------|
//! | *(none)* | Base functionality, always enabled | — |
//!
//! ## Quick example
//!
//! ```rust
//! use guardrail_core::{Pipeline, PipelineBuilder, Decision};
//!
//! // Build a pipeline (stages added by guardrail-classifiers)
//! let pipeline = PipelineBuilder::default().build();
//!
//! // A pipeline with no stages always allows
//! # tokio_test::block_on(async {
//! let req = guardrail_core::test_helpers::clean_request();
//! let (decision, _req) = pipeline.run(req).await.unwrap();
//! assert_eq!(decision, Decision::Allow);
//! # });
//! ```
//!
//! ## Further reading
//!
//! - [Configuration reference](https://github.com/Mattral/guardrail-rs/blob/main/docs/configuration.md) —
//! the full TOML schema for assembling a [`Pipeline`] via `guardrail-config`.
//! - [Threat model](https://github.com/Mattral/guardrail-rs/blob/main/docs/threat-model.md) —
//! what guardrail-rs protects against and its explicit trust boundaries.
//! - [Stage API reference](https://github.com/Mattral/guardrail-rs/blob/main/docs/stage-api.md) —
//! the contract every [`Stage`] implementation must satisfy.
//! - [Changelog](https://github.com/Mattral/guardrail-rs/blob/main/CHANGELOG.md) —
//! release history and notable changes.
pub use ;
pub use GuardrailError;
pub use ;
pub use ;