about summary refs log tree commit diff
path: root/src/libcore/option.rs
AgeCommit message (Collapse)AuthorLines
2018-08-10Also add a `From` implementation for `&mut Option<T>` -> `Option<&mut T>'Georg Semmler-0/+7
2018-08-09Add stability attributeGeorg Semmler-0/+1
2018-08-09inline some short functionsM Farkas-Dyck-0/+4
2018-08-09Add a implementation of `From` for converting `&'a Option<T>` intoGeorg Semmler-0/+6
`Option<&'a T>`
2018-07-29resolved upstream merge conflictsBrad Gibson-5/+80
2018-07-18Rollup merge of #52218 - rivertam:patch-1, r=withoutboatskennytm-2/+4
Amend option.take examples It wasn't abundantly clear to me what `.take` returned. Perhaps this is a slightly frivolous change, but I think it's an improvement. =) Apologies if I'm not following proper procedures.
2018-07-10Amend option.take examplesBen Berman-2/+4
It wasn't abundantly clear to me what `.take` returned. Perhaps this is a slightly frivolous change, but I think it's an improvement. =) Apologies if I'm not following proper procedures.
2018-07-09Fix the documentation of `Option::replace`Clément RENAULT-1/+1
2018-07-04Implement `Option::replace` in the core libraryKerollmops-0/+27
2018-06-26Rollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=withoutboatsPietro Albini-1/+1
New safe associated functions for PinMut - Add safe `get_mut` and `map` - Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked` The discussion about this starts [in this comment](https://github.com/rust-lang/rust/issues/49150#issuecomment-399604573) on the tracking issue.
2018-06-23`PinMut`: Add safe `get_mut` and rename unsafe fns to `get_mut_unchecked` ↵Josef Reinhard Brandl-1/+1
and `map_unchecked`
2018-06-20Replace unreachable! with unreachable_uncheckedMartin Glagla-3/+3
2018-05-22Add Option::as_pin_mutTaylor Cramer-0/+10
2018-05-15Add Option::xor methodClar Charr-0/+36
2018-04-30fixed some and added more testsBrad Gibson-1/+1
2018-04-26refactored to implement without traitBrad Gibson-18/+11
2018-04-26added DerefOption and DerefResult + tests to stdBrad Gibson-2/+19
2018-04-05Remove uses of option_filter featureThayne McCombs-2/+0
2018-04-01Stabilize `Option::filter`.Thayne McCombs-1/+1
Fixes #45860
2018-03-31Commit code for option size hintPhlosioneer-1/+6
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+5
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-06Stabilize option_ref_mut_clonedMatt Brubeck-2/+1
Closes #43738.
2018-03-06Auto merge of #48768 - kennytm:rollup, r=kennytmbors-3/+3
Rollup of 14 pull requests - Successful merges: #48403, #48432, #48546, #48573, #48590, #48657, #48727, #48732, #48753, #48754, #48761, #48474, #48507, #47463 - Failed merges:
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-3/+3
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-3/+3
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-02-26Fix doctest failurePhlosioneer-1/+0
Tried to be fancy with print statements.
2018-02-25Change the example string to something arbitraryPhlosioneer-4/+5
The choice of string is arbitrary, so all references to a number in the string were removed. The string is now the standard "Hello world!".
2018-02-24Slight modification to the as_ref example of std::option::OptionPhlosioneer-2/+2
A user in a reddit thread was confused by the name of the variable "num_as_int"; they thought the example was trying to convert the string "10" as if it were binary 2 by calling str::len(). In reality, the example is simply demonstrating how to take an immutable reference to the value of an Option. The confusion comes from the coincidence that the length of the string "10" is also its binary representation, and the implication from the variable names that a conversion was occuring ("num_as_str" to "num_as_int"). This PR changes the example number to 12 instead of 10, and changes the variable name from "num_as_int" to "num_length" to better communicate what the example is doing. The reddit thread: https://www.reddit.com/r/rust/comments/7zpvev/notyetawesome_rust_what_use_cases_would_you_like/dur39xw/
2018-01-20Rollup merge of #47193 - cramertj:result-opts, r=TimNNGuillaume Gomez-0/+29
Add transpose conversions for nested Option and Result These impls are useful when working with combinator methods that expect an option or a result, but you have a `Result<Option<T>, E>` instead of an `Option<Result<T, E>>` or vice versa.
2018-01-16Remove incorrect `Default::default` links, add a new oneGeoffry Song-7/+4
`map_or` and `map_or_else` don't use `Default::default`, but `unwrap_or_default` does.
2018-01-10Add transpose conversions for Option and ResultTaylor Cramer-0/+29
These impls are useful when working with combinator methods that expect an option or a result, but you have a Result<Option<T>, E> instead of an Option<Result<T, E>> or vice versa.
2017-12-07Rollup merge of #46548 - jonathanstrong:master, r=dtolnayGuillaume Gomez-0/+17
Recommends lazily evaluated alternatives for `Option::or` and `Result::or` Adds language to docs for `Option` and `Result` recommending the use of lazily evaluated alternatives when appropriate. These comments are intended to echo a [clippy lint] on the same topic. The [reddit discussion] may also be of interest. [clippy lint]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call [reddit discussion]: https://www.reddit.com/r/rust/comments/7hutqn/perils_of_optionor_and_resultor/
2017-12-07adds links to methods, removes trailing whitespaceJonathan Strong-5/+10
2017-12-06Adds language to the documentation for `Option` and `Result` suggestingJonathan Strong-0/+12
the use of lazily evaluated alternatives when appropriate. These comments are intended to echo a clippy lint on the same topic (see https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call)
2017-11-11Refactor Option::filter methodShanavas M-8/+4
2017-11-08Add `Option::filter()` according to RFC 2124Lukas Kalbertodt-0/+39
2017-09-27Rename option::Missing to NoneErrorHunter Praska-6/+9
2017-09-27Add docs for Missing, correct Option's Try testHunter Praska-1/+1
2017-09-27Impl Try for OptionHunter Praska-1/+24
2017-08-29Rollup merge of #43705 - panicbit:option_ref_mut_cloned, r=aturonAriel Ben-Yehuda-0/+20
libcore: Implement cloned() for Option<&mut T> None
2017-08-08Assign tracking issue to option_ref_mut_clonedpanicbit-1/+1
2017-08-07Fix Option<&mut T>::cloned doc testpanicbit-0/+1
2017-08-07libcore: Implement cloned() for Option<&mut T>panicbit-0/+19
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-07-25std: Stabilize `option_entry` featureAlex Crichton-6/+2
Stabilized: * `Option::get_or_insert` * `Option::get_or_insert_with` Closes #39288
2017-05-22Adding links to option::Optionprojektir-26/+60
2017-05-04Simplify types in `std::option` doc comment example.Corey Farwell-6/+6
2017-04-02Minor changes to core::option docsIrfan Hudda-6/+6
2017-04-01Improve docs of core::option::IterIrfan Hudda-1/+7
2017-04-01Improve docs of core::option::IterMutIrfan Hudda-1/+7