1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use regex::Regex; pub struct Link { link: String, } impl Link { pub fn new(link: String) -> Self { Link { link } } pub fn is_local_link(&self) -> bool { let regex = Regex::new(r"^(http|https)://").unwrap(); regex.is_match(&self.link) } }