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
//! Predicate combinators for composable validation logic
//!
//! This module provides composable predicate combinators for use in validation pipelines.
//! Predicates can be combined using logical operators (`and`, `or`, `not`) to build
//! complex validation rules from simple, reusable pieces.
//!
//! # Philosophy
//!
//! Instead of writing verbose boolean expressions or ad-hoc helper functions,
//! predicate combinators allow you to:
//!
//! - Build complex predicates from simple, reusable pieces
//! - Compose predicates using familiar logical operators
//! - Integrate seamlessly with `Validation` for error accumulation
//!
//! # Example
//!
//! ```rust
//! use stillwater::predicate::*;
//!
//! // Define reusable predicates for String type
//! let valid_len = len_between(3, 20);
//! let chars_ok = all_chars(|c: char| c.is_alphanumeric() || c == '_');
//!
//! // Check individual predicates
//! assert!(valid_len.check(&String::from("john_doe")));
//! assert!(!valid_len.check(&String::from("ab"))); // too short
//! assert!(!chars_ok.check(&String::from("invalid-name"))); // contains hyphen
//! ```
//!
//! # Integration with Validation
//!
//! ```rust
//! use stillwater::{Validation, predicate::*};
//!
//! let result = validate(String::from("hello"), len_min(3), "too short");
//! assert_eq!(result, Validation::success(String::from("hello")));
//!
//! let result = Validation::success(String::from("hello"))
//! .ensure(len_min(3), "too short")
//! .ensure(len_max(10), "too long");
//! assert_eq!(result, Validation::success(String::from("hello")));
//! ```
// Re-export core trait
pub use ;
// Re-export combinator types
pub use ;
// Re-export string predicates
pub use ;
// Re-export number predicates
pub use ;
// Re-export collection predicates
pub use ;
// Re-export validation integration
pub use ;