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 URLHttpUrl- composed asAnd<ValidUrl, HttpScheme>SecureUrl- composed asAnd<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§
- Http
Scheme - URL scheme must be http or https.
- Https
Only - URL scheme must be https (secure).
- Valid
Url - Any valid RFC 3986 URL.