From: bors Date: Wed, 19 Feb 2014 20:51:48 +0000 (-0800) Subject: auto merge of #12231 : wycats/rust/url_path_parse, r=alexcrichton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=6ae5de02235e453f8254b3f7cd1e0a45cebb33eb;p=rust.git auto merge of #12231 : wycats/rust/url_path_parse, r=alexcrichton It is sometimes useful to parse just the path portion of a URL (path, query string and fragment) rather than the entire URL. In theory I could have made Url embed a Path, but that would be a breaking change and I assume that Servo uses this API. I would be happy to update the PR to embed Path in Url if that's what people wanted. --- 6ae5de02235e453f8254b3f7cd1e0a45cebb33eb diff --cc src/libextra/url.rs index c76c73dc432,580e11b1158..4580dd93098 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@@ -736,8 -743,17 +775,17 @@@ impl FromStr for Url } } + impl FromStr for Path { + fn from_str(s: &str) -> Option { + match path_from_str(s) { + Ok(path) => Some(path), + Err(_) => None + } + } + } + /** - * Format a `url` as a string + * Converts a URL from `Url` to string representation. * * # Arguments *