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

API Docs: option #29366

Closed
steveklabnik opened this issue Oct 26, 2015 · 9 comments
Closed

API Docs: option #29366

steveklabnik opened this issue Oct 26, 2015 · 9 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority

Comments

@steveklabnik
Copy link
Member

Part of #29329

http://doc.rust-lang.org/std/option/

@leoyvens
Copy link
Contributor

In the as_mut and iter_mut examples, a match is used with a None => {} arm. if let would be more idiomatic.

@devonhollowood
Copy link
Contributor

In the documentation for unwrap_or (and maybe for related methods like ok_or and or), it would be nice to make a note that the arguments to a function are always fully evaluated, meaning that

fn foo(opt: Option<Bar>) -> Bar {
    let bar = opt.unwrap_or(return Bar::new());
    bar.baz()
}

will always return Bar::new() instead of opt.unwrap().baz(), even if opt is Some(_). This seems like a pitfall otherwise.

steveklabnik added a commit to steveklabnik/rust that referenced this issue Mar 24, 2016
@steveklabnik steveklabnik added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Mar 8, 2017
@steveklabnik
Copy link
Member Author

I am happy to mentor anyone who wants to tackle this issue.

@steveklabnik steveklabnik added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Mar 10, 2017
@steveklabnik steveklabnik added E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. P-medium Medium priority and removed A-docs labels Mar 24, 2017
@irfanhudda
Copy link
Contributor

@steveklabnik I'd like to help on this.

@steveklabnik
Copy link
Member Author

@irfanhudda awesome! Let me know if I can help you help us in any way :)

@irfanhudda
Copy link
Contributor

irfanhudda commented Mar 31, 2017

@steveklabnik Module level docs look fine here. I think the documentation of IntoIter, Iter and IterMut structs can be improved. Do we also need examples or anything else?

@steveklabnik
Copy link
Member Author

Oh, I just noticed I didn't add a checklist for this issue!

They do not need examples, but they should follow the standard iterator boilerplate: https://doc.rust-lang.org/stable/std/iter/struct.SkipWhile.html

An iterator that rejects elements while predicate is true.

This struct is created by the skip_while() method on Iterator. See its documentation for more.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 5, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 5, 2017
…teveklabnik

Improve option API docs

Associated Issue: rust-lang#29366

Improve `option` API docs for
* `IntoIter` struct
* `Iter` struct
* `IterMut` struct

r? @steveklabnik
@chordowl
Copy link
Contributor

I think this issue can be closed (as of #40999); the docs look pretty good now!

@steveklabnik
Copy link
Member Author

:D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

5 participants