pub fn is_valid_https_url(url: &str) -> boolExpand description
Validates if a string is a valid HTTPS URL only
Examples found in repository?
examples/error_handling.rs (line 32)
18 fn validate(&self) -> Result<(), Vec<ValidationError>> {
19 let mut errors = Vec::new();
20
21 // Validate email
22 if !is_valid_email(&self.email) {
23 errors.push(ValidationError::new("email", "Invalid email format"));
24 }
25
26 // Validate phone
27 if !is_valid_phone(&self.phone) {
28 errors.push(ValidationError::new("phone", "Invalid phone number"));
29 }
30
31 // Validate website
32 if !is_valid_https_url(&self.website) {
33 errors.push(ValidationError::new("website", "Must be a valid HTTPS URL"));
34 }
35
36 // Validate credit card
37 if !credit_card::is_valid_credit_card(&self.credit_card) {
38 errors.push(ValidationError::new("credit_card", "Invalid credit card number"));
39 }
40
41 if errors.is_empty() {
42 Ok(())
43 } else {
44 Err(errors)
45 }
46 }