Skip to main content

rusdantic_core/
lib.rs

1//! # rusdantic-core
2//!
3//! Core validation traits, error types, and built-in validation rules for the
4//! Rusdantic framework. This crate is the runtime component — it contains
5//! everything that the derive macro's generated code calls at runtime.
6//!
7//! Users should not depend on this crate directly. Instead, use the `rusdantic`
8//! facade crate which re-exports everything needed.
9
10#![warn(missing_docs)]
11
12pub mod adapter;
13pub mod coerce;
14pub mod dump;
15pub mod error;
16pub mod rules;
17pub mod traits;
18
19// Re-export core types at the crate root for ergonomic use in generated code.
20// The derive macro generates code like `::rusdantic_core::Validate`,
21// `::rusdantic_core::ValidationErrors`, etc.
22pub use error::{PathSegment, ValidationError, ValidationErrors};
23pub use traits::Validate;
24
25/// Re-export regex for use in generated code (OnceLock<Regex> statics).
26/// This avoids requiring users to add `regex` as a direct dependency.
27pub mod re_export {
28    pub use regex::Regex;
29}