[![url-badge]][url] [![cat-net-badge]][cat-net]
解析Url
,并url::Position
把它切成片,删除不需要的 URL 部分。
extern crate url;
use url::{Url, Position, ParseError};
fn main() -> Result<(), ParseError> {
let parsed = Url::parse("https://github.com/rust-lang/rust/issues?labels=E-easy&state=open")?;
let cleaned: &str = &parsed[..Position::AfterPath];
println!("cleaned: {}", cleaned);
Ok(())
}