[go: up one dir, main page]

Module garde::rules::url

source ·
Expand description

URL validation using the url crate.

#[derive(garde::Validate)]
struct Test {
    #[garde(url)]
    v: String,
}

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

The url crate only allows parsing from a &str, which is why this trait has a blanket implementation for all T: AsRef<str>.

If you need to implement this for a string-like type where a contiguous slice of the entire contents cannot be obtained, then there is currently no way for you to implement this trait.

Traits

Functions