Module url

Module url 

Source
Expand description

URL validation types.

Provides RFC 3986 compliant URL validation using the url crate (WHATWG URL Standard).

This module demonstrates stillwater’s predicate composition using the And combinator:

  • Url - any valid RFC 3986 URL
  • HttpUrl - composed as And<ValidUrl, HttpScheme>
  • SecureUrl - composed as And<ValidUrl, HttpsOnly>

§Example

use stilltypes::url::{Url, HttpUrl, SecureUrl};

// Any valid URL
let url = Url::new("https://example.com".to_string());
assert!(url.is_ok());

// HTTP or HTTPS only
let http = HttpUrl::new("http://example.com".to_string());
assert!(http.is_ok());

// HTTPS only (secure)
let https = SecureUrl::new("https://example.com".to_string());
assert!(https.is_ok());

let insecure = SecureUrl::new("http://example.com".to_string());
assert!(insecure.is_err());

Structs§

HttpScheme
URL scheme must be http or https.
HttpsOnly
URL scheme must be https (secure).
ValidUrl
Any valid RFC 3986 URL.

Type Aliases§

HttpUrl
HTTP or HTTPS URL.
SecureUrl
HTTPS-only URL (secure).
Url
Any valid URL (RFC 3986).