Skip to content

Commit

Permalink
Auto merge of servo#495 - djmitche:position-in-docs, r=SimonSapin
Browse files Browse the repository at this point in the history
Include url::Position in top-level docs

This helps discoverability of this pretty cool functionality.

Follow-up from servo#492.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/495)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Apr 24, 2019
2 parents a1d8c88 + 8db631c commit 89dc0b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ assert!(Url::parse("http://[:::1]") == Err(ParseError::InvalidIpv6Address))
Let’s parse a valid URL and look at its components.
```
use url::{Url, Host};
use url::{Url, Host, Position};
# use url::ParseError;
# fn run() -> Result<(), ParseError> {
let issue_list_url = Url::parse(
Expand All @@ -43,6 +43,7 @@ assert!(issue_list_url.path() == "/rust-lang/rust/issues");
assert!(issue_list_url.path_segments().map(|c| c.collect::<Vec<_>>()) ==
Some(vec!["rust-lang", "rust", "issues"]));
assert!(issue_list_url.query() == Some("labels=E-easy&state=open"));
assert!(&issue_list_url[Position::BeforePath..] == "/rust-lang/rust/issues?labels=E-easy&state=open");
assert!(issue_list_url.fragment() == None);
assert!(!issue_list_url.cannot_be_a_base());
# Ok(())
Expand Down

0 comments on commit 89dc0b7

Please sign in to comment.