tldextract 0.6.0

extract domain info from a url
Documentation
mod local;
#[cfg(feature = "remote")]
mod remote;
mod snapshot;

use std::collections::HashSet;

use crate::errors::Result;


#[cfg(feature = "remote")]
pub fn get_tld_cache<'a, O>(local_path: O, private_domains: bool) -> HashSet<String>
where
    O: Into<Option<&'a str>>,
{
    local::get_tld_cache(local_path)
        .or_else(|_| remote::get_tld_cache(private_domains))    
        .or_else(|_| snapshot::get_tld_cache())
        .unwrap()
}


pub fn get_tld_cache<'a, O>(local_path: O, private_domains: bool) -> HashSet<String>
where
    O: Into<Option<&'a str>>,
{
    local::get_tld_cache(local_path)
        .or_else(|_| snapshot::get_tld_cache())
        .unwrap()
}

pub fn set_tld_cache<'a, O>(local_path: O, cache: &HashSet<String>) -> Result<()>
where
    O: Into<Option<&'a str>>,
{
    local::set_tld_cache(local_path, cache)
}