Skip to content

Commit 2c1acd7

Browse files
committed
Add struct and type doc comments for extra::url::*
Updated doc comments further, following suggestions from huonw in PR #10752.
1 parent 0515e05 commit 2c1acd7

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/libextra/url.rs

+20-6
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,35 @@ use std::uint;
2222
/// A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource
2323
/// Identifier) that includes network location information, such as hostname or
2424
/// port number.
25+
///
26+
/// # Example
27+
///
28+
/// ```rust
29+
/// let url = Url { scheme: ~"https",
30+
/// user: Some(UserInfo { user: ~"username", pass: None }),
31+
/// host: ~"example.com",
32+
/// port: Some(~"8080"),
33+
/// path: ~"/foo/bar",
34+
/// query: ~[(~"baz", ~"qux")],
35+
/// fragment: Some(~"quz") };
36+
/// // https://[email protected]:8080/foo/bar?baz=qux#quz
37+
/// ```
2538
#[deriving(Clone, Eq)]
2639
pub struct Url {
27-
/// The scheme part of a URL, such as `http`, `ftp` or `mailto`.
40+
/// The scheme part of a URL, such as `https` in the above example.
2841
scheme: ~str,
29-
/// A URL subcomponent for user authentication.
42+
/// A URL subcomponent for user authentication. `username` in the above example.
3043
user: Option<UserInfo>,
31-
/// A domain name or IP address. For example, `www.example.com`.
44+
/// A domain name or IP address. For example, `example.com`.
3245
host: ~str,
3346
/// A TCP port number, for example `8080`.
3447
port: Option<~str>,
35-
/// The path component of a URL, for example `/users/jsmith`.
48+
/// The path component of a URL, for example `/foo/bar`.
3649
path: ~str,
37-
/// The query component of a URL.
50+
/// The query component of a URL. `~[(~"baz", ~"qux")]` represents the
51+
/// fragment `baz=qux` in the above example.
3852
query: Query,
39-
/// The fragment component. Does not include the leading hash or pound sign.
53+
/// The fragment component, such as `quz`. Doesn't include the leading `#` character.
4054
fragment: Option<~str>
4155
}
4256

0 commit comments

Comments
 (0)