skp_validator_core/
lib.rs

1//! # skp-validator-core
2//!
3//! Core traits and types for the skp-validator validation library.
4//!
5//! This crate provides the foundational building blocks:
6//! - [`Validate`] - Core trait for validatable types
7//! - [`Rule`] - Trait for individual validation rules
8//! - [`Transform`] - Trait for field transformations
9//! - [`ValidationErrors`] - Structured, nested error container
10//! - [`ValidationContext`] - Runtime context for validation
11//!
12//! ## Example
13//!
14//! ```rust,ignore
15//! use skp_validator_core::{Validate, ValidationResult};
16//!
17//! struct User {
18//!     name: String,
19//!     email: String,
20//! }
21//!
22//! impl Validate for User {
23//!     fn validate_with_context(&self, ctx: &ValidationContext) -> ValidationResult<()> {
24//!         // Validation logic here
25//!         Ok(())
26//!     }
27//! }
28//! ```
29
30mod context;
31mod error;
32mod path;
33mod result;
34pub mod schema;
35mod traits;
36
37pub use context::*;
38pub use error::*;
39pub use path::*;
40pub use result::*;
41pub use traits::*;
42
43/// Prelude module for convenient imports
44pub mod prelude {
45    pub use crate::context::ValidationContext;
46    pub use crate::error::{FieldErrors, ValidationError, ValidationErrors};
47    pub use crate::path::{FieldPath, PathSegment};
48    pub use crate::result::ValidationResult;
49    pub use crate::traits::{Rule, Transform, Validate, ValidateDive, ValidateNested};
50}