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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! # Stilltypes
//!
//! Domain-specific refined types for the Stillwater ecosystem.
//!
//! Stilltypes provides production-ready predicates and type aliases for common
//! domain types like email addresses, URLs, phone numbers, and more. All types
//! integrate seamlessly with [stillwater](https://docs.rs/stillwater)'s
//! `Validation` for error accumulation and `Effect` for composable I/O.
//!
//! ## Quick Start
//!
//! ```
//! use stilltypes::prelude::*;
//!
//! // Types validate on construction
//! # #[cfg(feature = "email")]
//! # {
//! let email = Email::new("user@example.com".to_string());
//! assert!(email.is_ok());
//!
//! // Invalid values fail with helpful errors
//! let bad = Email::new("invalid".to_string());
//! assert!(bad.is_err());
//! println!("{}", bad.unwrap_err());
//! // invalid email address: invalid format, expected local@domain (example: user@example.com)
//! # }
//! ```
//!
//! ## Feature Flags
//!
//! Enable only what you need:
//!
//! ```toml
//! [dependencies]
//! stilltypes = { version = "0.1", default-features = false, features = ["email", "url"] }
//! ```
//!
//! | Feature | Types | Dependencies |
//! |---------|-------|--------------|
//! | `email` (default) | `Email` | `email_address` |
//! | `url` (default) | `Url`, `HttpUrl`, `SecureUrl` | `url` |
//! | `uuid` | `Uuid`, `UuidV4`, `UuidV7` | `uuid` |
//! | `phone` | `PhoneNumber` | `phonenumber` |
//! | `financial` | `Iban`, `CreditCardNumber` | `iban_validate`, `creditcard` |
//! | `network` | `Ipv4Addr`, `Ipv6Addr`, `DomainName`, `Port` | - |
//! | `geo` | `Latitude`, `Longitude` | - |
//! | `numeric` | `Percentage`, `UnitInterval` | - |
//! | `identifiers` | `Slug` | - |
//! | `serde` | Serialize/Deserialize for all types | - |
//! | `full` | All of the above | - |
//!
//! ## Error Accumulation with Stillwater
//!
//! Collect all validation errors at once using stillwater's `Validation`:
//!
//! ```ignore
//! use stilltypes::prelude::*;
//! use stillwater::validation::Validation;
//!
//! fn validate_form(email: String, phone: String) -> Validation<ValidForm, Vec<DomainError>> {
//! Validation::all((
//! Email::new(email).map_err(|e| vec![e]),
//! PhoneNumber::new(phone).map_err(|e| vec![e]),
//! ))
//! .map(|(email, phone)| ValidForm { email, phone })
//! }
//! ```
//!
//! ## Serde Integration
//!
//! With the `serde` feature, types validate during deserialization:
//!
//! ```ignore
//! use stilltypes::prelude::*;
//! use serde::Deserialize;
//!
//! #[derive(Deserialize)]
//! struct User {
//! email: Email,
//! website: Option<SecureUrl>,
//! }
//!
//! // Invalid JSON fails to deserialize
//! let result: Result<User, _> = serde_json::from_str(json);
//! ```
//!
//! ## Philosophy
//!
//! Stilltypes follows the [Stillwater philosophy](https://github.com/iepathos/stillwater):
//!
//! - **Parse, Don't Validate** - Domain types encode invariants in the type
//! - **Errors Should Tell Stories** - Rich context for user-facing messages
//! - **Composition Over Complexity** - Uses stillwater's `And`, `Or`, `Not`
//! - **Pragmatism Over Purity** - Real-world formats, not theoretical perfection
pub use ;