You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: regex.rs
    path of file: ./repos/spyglass/crates/shared/src
    
    the code of the file until where you have to start completion: #[derive(PartialEq, Eq)]
pub enum WildcardType {
    Database,
    Regex,
}

pub fn regex_for_domain(domain: &str) -> String {
    let mut regex = String::new();
    for ch in domain.chars() {
        match ch {
            '*' => regex.push_str(".*"),
            _ => regex.push_str(&regex::escape(&ch.to_string())),
        }
    }

    format!("^(http://|https://){regex}.*")
}

pub fn regex_for_prefix(prefix: &str) -> String {
    if prefix.ends_with('$') {
        let escaped = regex::escape(prefix.strip_suffix('$').unwrap());
        format!("^{escaped}$")
    } else {
        let escaped = regex::escape(prefix);
        format!("^{escaped}.*")
    }
}

/// Convert a robots.txt rule into a proper regex string
pub fn regex_for_robots(rule: &str, wildcard_type: WildcardType) -> Option<String> {
    if rule.is_empty() {
        return None;
    }

    let wildcard = match wildcard_type {
        WildcardType::Database => "%",
        WildcardType::Regex => ".*",
    };

    let mut regex = String::new();
    let mut has_end = false;
    for ch in rule.chars() {
        match ch {
            '*' => regex.push_str(wildcard),
            '^' => {
    
pub fn regex_for_robots(rule: &str, wildcard_type: WildcardType) -> Option<String> {
    if rule.is_empty() {
        return None;
    }

    let wildcard = match wildcard_type {
        WildcardType::Database => "%",
        WildcardType::Regex => ".*",
    };

    let mut regex = String::new();
    let mut has_end = false;
    for ch in rule.chars() {
        match ch {
            '*' => regex.push_str(wildcard),
            '^' => {
                // Ignore carets when converting for database
                if wildcard_type == WildcardType::Regex {
                    regex.push('^');
                    has_end = true;
                }
            }
            other_ch => match wildcard_type {
                WildcardType::Database => match other_ch {
                    // % and _ characters are treated as wildcards in SQLite
                    '%' => regex.push_str("\\%"),
                    '_' => regex.push_str("\\_"),
                    _ => regex.push(other_ch),
                },
                WildcardType::Regex => {
                    regex.push_str(&regex::escape(&other_ch.to_string()));
                }
            },
        }
    }

    if !has_end && !regex.ends_with(wildcard) {
        regex.push_str(wildcard);
    }

    Some(regex)
}