Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add struct and type doc comments for extra::url::* #10752

Merged
merged 2 commits into from
Dec 4, 2013
Merged

Add struct and type doc comments for extra::url::* #10752

merged 2 commits into from
Dec 4, 2013

Conversation

dhodder
Copy link
Contributor

@dhodder dhodder commented Dec 1, 2013

No description provided.

scheme: ~str,
/// A URL subcomponent for user authentication.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the user part of https://user@example.com:8080/foo/bar?baz=qux#quz? (It would be neat if this had an example URL (e.g. the one I just gave, assuming it covers everything) in the main heading on the struct itself, and then the documentation on each field referred back to the appropriate part so it was unambiguous.)

@dhodder
Copy link
Contributor Author

dhodder commented Dec 1, 2013

It is indeed the user part. Does the following look okay to you? I've added an example URL and updated the descriptions on the individual attributes.

/// A Uniform Resource Locator (URL).  A URL is a form of URI (Uniform Resource
/// Identifier) that includes network location information, such as hostname or
/// port number.
///
/// # Example
///
/// ```rust
/// let url = Url { scheme: ~"https",
///                 user: Some(UserInfo { user: ~"username", pass: None }),
///                 host: ~"example.com",
///                 port: Some(~"8080"),
///                 path: ~"/foo/bar",
///                 query: ~[(~"baz", ~"qux")],
///                 fragment: Some(~"quz") };
/// // https://username@example.com:8080/foo/bar?baz=qux#quz
/// ```
#[deriving(Clone, Eq)]
pub struct Url {
    /// The scheme part of a URL, such as `https` in the above example.
    scheme: ~str,
    /// A URL subcomponent for user authentication.
    /// `Some(UserInfo { user: ~"username", pass: None })` in the example above.
    user: Option<UserInfo>,
    /// A domain name or IP address.  For example, `example.com`.
    host: ~str,
    /// A TCP port number, for example `8080`.
    port: Option<~str>,
    /// The path component of a URL, for example `/foo/bar`.
    path: ~str,
    /// The query component of a URL.  `~[(~"baz", ~"qux")]` represents the
    /// fragment `baz=qux` in the above example.
    query: Query,
    /// The fragment component, such as `quz`.  Does not include the leading hash or pound sign.
    fragment: Option<~str>
}

Thanks!

@huonw
Copy link
Member

huonw commented Dec 1, 2013

I think the user part should say just "username in the above example" rather than using the Rust struct syntax. Also choose one for "hash or pound sign" (you could even write "doesn't include the leading #"), at the moment it could be interpreted as "doesn't include the leading hash, and also doesn't include the leading pound sign" which is nonsensical but may be confusing to a nonnative speaker.

Updated doc comments further, following suggestions from huonw in PR
#10752.
bors added a commit that referenced this pull request Dec 4, 2013
@bors bors closed this Dec 4, 2013
@bors bors merged commit 2c1acd7 into rust-lang:master Dec 4, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 20, 2023
…affate

Ignore expressions from macros in `default_constructed_unit_structs`

changelog: none, should be the same release as the lint itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants