Debian Codegraph @

src/url_parser/parser_full.rs

raw symbols SCIP
1 use url::{Url};
2
3 fn parse_url(url: &str) -> Option<Url> {
4 url.parse::<Url>()
5 .ok() // convert to Option
6 }
7
8 pub fn get_url_host(url: &str) -> Option<String> {
9 parse_url(url)
10 .and_then(|p| p.host_str().map(String::from))
11 }