Expand description
§Catfive
Catfive is a category-5, fluent, zero-dependency schema and form validation library for Rust.
Inspired by developer-friendly validation libraries, it lets you construct composable validation
rules without procedural attribute macros (#[derive(...)]).
§Key Features
- Macro-free: Clean, functional, and composable builder API.
- Zero dependencies: Core validation operates entirely on
std. - Cloneable Validators: All validators implement
Clonefor easy template reuse. - Detailed errors & Custom Messages: Rules support
println!-style placeholders (e.g.{char},{min},{count}) or closures. - Form and Schema support: Validate untyped form payloads as well as strongly-typed Rust structs with nested schemas and refinements.
- Collections & Lists: Validate arrays and vectors with
list(...). - Optional Serde: Enable the
serdeCargo feature to serialize validation errors to JSON for REST APIs. - Optional Regex: Enable the
regexCargo feature for arbitrary pattern matching.
Re-exports§
pub use error::FieldError;pub use error::ValidationError;pub use error::ValidationErrors;pub use form::FormData;pub use form::FormValidator;pub use list::ListValidator;pub use number::NumberValidator;pub use schema::Schema;pub use string::StringValidator;pub use traits::Validator;
Modules§
- error
- form
- list
- number
- prelude
- Convenient prelude module to import all essential traits and constructors.
- schema
- spek
- string
- traits
Functions§
- form
- Creates a new form validator for key-value payloads.
- list
- Creates a new fluent list/array validator for collections of items.
- number
- Creates a new fluent numeric validator for any compatible number type.
- schema
- Creates a new strongly-typed schema validator for struct
T. - string
- Creates a new fluent string validator.