about summary refs log tree commit diff
path: root/src/libcore/result.rs
AgeCommit message (Collapse)AuthorLines
2019-03-11impl FromIterator for Result: Use assert_eq! instead of assert!Chris Gregory-1/+1
2019-02-10libs: doc commentsAlexander Regueiro-1/+1
2019-01-13stabilize transpose_result in 1.33Mazdak Farrokhzad-3/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-8/+8
2018-09-12Rollup merge of #53777 - ivanbakel:result_map_or_else, r=alexcrichtonkennytm-0/+30
Implemented map_or_else for Result<T, E> Fulfills #53268 The example is ripped from `Option::map_or_else`, with the types corrected.
2018-09-06Fix invalid urlsGuillaume Gomez-9/+3
2018-08-30Added feature attribute to example code in map_or_else docIsaac van Bakel-0/+1
2018-08-29Corrected type variable output T -> U in Result::map_or_elseIsaac van Bakel-1/+1
2018-08-29Corrected feature status of Result::map_or_elseIsaac van Bakel-1/+1
map_or_else is now correctly labelled unstable and points to the tracking issue on rust-lang/rust
2018-08-29Corrected bad typing in Result::map_or_else docIsaac van Bakel-2/+2
The error value now includes the type of the success. The success value now includes the type of the error.
2018-08-29Corrected feature name for map_or_elseIsaac van Bakel-1/+1
2018-08-29Implemented map_or_else for Result<T, E>Isaac van Bakel-0/+29
2018-08-09inline some short functionsM Farkas-Dyck-0/+4
2018-07-29resolved upstream merge conflictsBrad Gibson-1/+1
2018-05-07Add explanation for #[must_use] on ResultManish Goregaokar-1/+1
2018-04-27separated inner_deref Result implsBrad Gibson-1/+7
2018-04-26cleaned up #[unstable] attributesBrad Gibson-3/+1
2018-04-26refactored to implement without traitBrad Gibson-57/+34
2018-04-26added DerefOption and DerefResult + tests to stdBrad Gibson-1/+58
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-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/+10
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-4/+6
2017-12-06Adds language to the documentation for `Option` and `Result` suggestingJonathan Strong-0/+8
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-12-05Mention the name of ? in Result's docssteveklabnik-4/+4
Fixes #42725 or at least, this is the best we can really do. #35946 is tracking better errors already, so that should cover the other part of it.
2017-10-10core: derive Clone for result::IntoIterJosh Stone-1/+1
It appears to be a simple oversight that `result::IntoIter<T>` doesn't implement `Clone` (where `T: Clone`). We do already have `Clone` for `result::Iter`, as well as the similar `option::IntoIter` and `Iter`.
2017-08-18Add missing urls for Result structGuillaume Gomez-27/+73
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-06-09Simplify FromIterator example of ResultGeorg Brandl-6/+3
2017-05-31Give the `try_trait` feature its own tracking issueScott McMurray-1/+1
2017-05-25Lower `?` to `Try` instead of `Carrier`Scott McMurray-0/+19
The easy parts of RFC 1859. (Just the trait and the lowering, none of the error message improvements nor the insta-stable impl for Option.)
2017-03-28Fix external doc errorsGuillaume Gomez-1/+1
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-2/+2
2017-03-17Stabilize expect_err feature, closes #39041Aaron Turon-2/+1
2017-02-12Sustitutes try! for ? in the Result documentationJordi Polo-23/+15
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-3/+1
This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-13expect_err for Result.Clar Charr-0/+25
2016-12-13doc: Explain meaning of Result iters and link to factory functions.Martin Pool-3/+26
2016-11-04Auto merge of #37306 - bluss:trusted-len, r=alexcrichtonbors-1/+10
Add Iterator trait TrustedLen to enable better FromIterator / Extend This trait attempts to improve FromIterator / Extend code by enabling it to trust the iterator to produce an exact number of elements, which means that reallocation needs to happen only once and is moved out of the loop. `TrustedLen` differs from `ExactSizeIterator` in that it attempts to include _more_ iterators by allowing for the case that the iterator's len does not fit in `usize`. Consumers must check for this case (for example they could panic, since they can't allocate a collection of that size). For example, chain can be TrustedLen and all numerical ranges can be TrustedLen. All they need to do is to report an exact size if it fits in `usize`, and `None` as the upper bound otherwise. The trait describes its contract like this: ``` An iterator that reports an accurate length using size_hint. The iterator reports a size hint where it is either exact (lower bound is equal to upper bound), or the upper bound is `None`. The upper bound must only be `None` if the actual iterator length is larger than `usize::MAX`. The iterator must produce exactly the number of elements it reported. This trait must only be implemented when the contract is upheld. Consumers of this trait must inspect `.size_hint()`’s upper bound. ``` Fixes #37232
2016-11-04Link the tracking issue for TrustedLenUlrik Sverdrup-3/+3
2016-11-01Add tracking issue number to Result::unwrap_or_default unstable annotation.Mark-Simulacrum-1/+1
2016-11-01Auto merge of #37299 - devonhollowood:result-unwrap-or-default, r=alexcrichtonbors-0/+38
Add `unwrap_or_default` method to `Result` Fixes #37025
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-25Add size hint to Result's FromIterator implementation.Mark-Simulacrum-0/+5
2016-10-21Fix use of `result_unwrap_or_default` featureDevon Hollowood-0/+2
2016-10-20Make `Result`'s `unwrap_or_default` unstableDevon Hollowood-3/+6
2016-10-20Implement TrustedLen for more iteratorsUlrik Sverdrup-1/+10
2016-10-19Add `unwrap_or_default` method to `Result`Devon Hollowood-0/+33