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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # domainstack
//!
//! domainstack turns untrusted input into valid-by-construction domain objects, and returns stable,
//! field-level errors your APIs and UIs can depend on.
//!
//! It's built for the boundary you actually live at:
//!
//! **HTTP/JSON/etc. → DTOs → Domain (validated) → Business logic**
//!
//! Most validation crates ask: **"Is this DTO valid?"**
//! domainstack asks: **"How do I safely construct domain models from untrusted input—and report failures with a consistent error contract?"**
//!
//! ## What that gives you
//!
//! - **Domain-first modeling**: invalid states are hard/impossible to represent
//! - **Composable rule algebra**: reusable rules with `.and()`, `.or()`, `.when()`
//! - **Structured error paths**: `rooms[0].adults`, `guest.email.value` (UI-friendly)
//! - **Async validation with context**: DB/API checks like uniqueness, rate limits
//! - **Cross-field validation**: invariants like password confirmation, date ranges
//! - **Type-state tracking**: phantom types to enforce "validated" at compile time
//! - **Schema + client parity**: generate OpenAPI and TypeScript/Zod from the same Rust rules
//! - **Framework adapters**: one-line boundary extraction (Axum / Actix / Rocket)
//! - **Lean core**: zero-deps base, opt-in features for regex / async / chrono / serde
//!
//! ## Quick Start
//!
//! ```rust
//! use domainstack::prelude::*;
//!
//! // Validate a username with composable rules
//! let username = "alice";
//! let rule = rules::min_len(3).and(rules::max_len(20));
//!
//! match validate("username", username, &rule) {
//! Ok(_) => println!("Username is valid!"),
//! Err(e) => {
//! for v in &e.violations {
//! println!("[{}] {} - {}", v.path, v.code, v.message);
//! }
//! }
//! }
//! ```
//!
//! For more complex examples with `#[derive(Validate)]`, cross-field validation, and nested types,
//! see the [examples directory](https://github.com/blackwell-systems/domainstack/tree/main/domainstack/domainstack-examples)
//! or check out the [booking system example](https://github.com/blackwell-systems/domainstack#quick-start) in the README.
//!
//! With framework adapters (Axum/Actix/Rocket), this becomes a one-line extraction:
//! `DomainJson<Booking, BookingDto>` automatically deserializes, validates, and converts DTOs
//! to domain types—returning structured errors to clients on failure.
//!
//! ## Documentation
//!
//! - [Core Concepts](https://github.com/blackwell-systems/domainstack/blob/main/domainstack/domainstack/docs/CORE_CONCEPTS.md) - Foundation principles and patterns
//! - [Rules Reference](https://github.com/blackwell-systems/domainstack/blob/main/domainstack/domainstack/docs/RULES.md) - All 37 validation rules
//! - [Examples](https://github.com/blackwell-systems/domainstack/tree/main/domainstack/domainstack-examples) - 9 runnable examples
pub use RuleContext;
pub use ValidationError;
pub use validate;
pub use ;
pub use Rule;
pub use Validate;
pub use ;
pub use ;
pub use Validate;