type_lib/prelude.rs
1//! Common imports for working with `type-lib`.
2//!
3//! Glob-import this module to bring the foundation types and the composition
4//! combinators into scope in one line. The built-in [rules](crate::rules) are
5//! intentionally left out to keep the namespace small; import the ones you need
6//! from `type_lib::rules`.
7//!
8//! # Examples
9//!
10//! ```rust
11//! use type_lib::prelude::*;
12//! use type_lib::rules::{Ascii, NonEmpty};
13//!
14//! // `Refined`, `Validator`, `ValidationError`, and `And`/`Or`/`Not` are all in
15//! // scope from the prelude.
16//! type Token<'a> = Refined<&'a str, And<NonEmpty, Ascii>>;
17//!
18//! assert!(Token::new("abc123").is_ok());
19//! assert!(Token::new("").is_err());
20//! ```
21
22pub use crate::combinator::{And, Not, Or};
23pub use crate::error::ValidationError;
24pub use crate::refined::Refined;
25pub use crate::validator::Validator;