MCPcopy Create free account
hub / github.com/biblius/validify / Validify

Interface Validify

validify/src/lib.rs:103–106  ·  view source on GitHub ↗

Deriving [Validify] allows you to modify structs before they are validated by providing a out of the box validation implementations as well as the ability to write custom ones. ### Example ``` use validify::Validify; #[derive(Debug, Clone, serde::Deserialize, Validify)] struct Testor { #[modify(lowercase, trim)] #[validate(length(equal = 8))] pub a: String, #[modify(trim, uppercase)] pub b: Opt

Source from the content-addressed store, hash-verified

101/// assert_eq!(test.nested.b, "Capitalize me.");
102/// ```
103pub trait Validify: Modify + Validate {
104 /// Apply the provided modifiers to self and run validations.
105 fn validify(&mut self) -> Result<(), ValidationErrors>;
106}
107
108/// Exposes validify functionality on generated [Payload] structs.
109pub trait ValidifyPayload: Sized {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected