Module prefix

Module prefix 

Source
Expand description

Prefix validation.

const PRE: &str = "test_";

#[derive(garde::Validate)]
struct Test {
    #[garde(prefix("test_"))]
    v: String,
    #[garde(prefix(PRE))]
    w: String,
}

The entrypoint is the Prefix trait. Implementing this trait for a type allows that type to be used with the #[garde(prefix)] rule.

This trait has a blanket implementation for all T: garde::rules::AsStr.

Traits§

Prefix

Functions§

apply