Skip to content

Commit 89dc0b7

Browse files
author
bors-servo
authored
Auto merge of #495 - djmitche:position-in-docs, r=SimonSapin
Include url::Position in top-level docs This helps discoverability of this pretty cool functionality. Follow-up from #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 -->
2 parents a1d8c88 + 8db631c commit 89dc0b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ assert!(Url::parse("http://[:::1]") == Err(ParseError::InvalidIpv6Address))
2525
Let’s parse a valid URL and look at its components.
2626
2727
```
28-
use url::{Url, Host};
28+
use url::{Url, Host, Position};
2929
# use url::ParseError;
3030
# fn run() -> Result<(), ParseError> {
3131
let issue_list_url = Url::parse(
@@ -43,6 +43,7 @@ assert!(issue_list_url.path() == "/rust-lang/rust/issues");
4343
assert!(issue_list_url.path_segments().map(|c| c.collect::<Vec<_>>()) ==
4444
Some(vec!["rust-lang", "rust", "issues"]));
4545
assert!(issue_list_url.query() == Some("labels=E-easy&state=open"));
46+
assert!(&issue_list_url[Position::BeforePath..] == "/rust-lang/rust/issues?labels=E-easy&state=open");
4647
assert!(issue_list_url.fragment() == None);
4748
assert!(!issue_list_url.cannot_be_a_base());
4849
# Ok(())

0 commit comments

Comments
 (0)