Skip to content

Commit 50e9d4f

Browse files
committed
auto merge of #10752 : dhodder/rust/master, r=pcwalton
2 parents 693ec73 + 2c1acd7 commit 50e9d4f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/libextra/url.rs

+28
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,51 @@ use std::hashmap::HashMap;
1919
use std::to_bytes;
2020
use std::uint;
2121

22+
/// A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource
23+
/// Identifier) that includes network location information, such as hostname or
24+
/// 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+
/// ```
2238
#[deriving(Clone, Eq)]
2339
pub struct Url {
40+
/// The scheme part of a URL, such as `https` in the above example.
2441
scheme: ~str,
42+
/// A URL subcomponent for user authentication. `username` in the above example.
2543
user: Option<UserInfo>,
44+
/// A domain name or IP address. For example, `example.com`.
2645
host: ~str,
46+
/// A TCP port number, for example `8080`.
2747
port: Option<~str>,
48+
/// The path component of a URL, for example `/foo/bar`.
2849
path: ~str,
50+
/// The query component of a URL. `~[(~"baz", ~"qux")]` represents the
51+
/// fragment `baz=qux` in the above example.
2952
query: Query,
53+
/// The fragment component, such as `quz`. Doesn't include the leading `#` character.
3054
fragment: Option<~str>
3155
}
3256

57+
/// An optional subcomponent of a URI authority component.
3358
#[deriving(Clone, Eq)]
3459
pub struct UserInfo {
60+
/// The user name.
3561
user: ~str,
62+
/// Password or other scheme-specific authentication information.
3663
pass: Option<~str>
3764
}
3865

66+
/// Represents the query component of a URI.
3967
pub type Query = ~[(~str, ~str)];
4068

4169
impl Url {

0 commit comments

Comments
 (0)