summary refs log tree commit diff
path: root/src/libcore/result.rs
AgeCommit message (Collapse)AuthorLines
2018-05-07Add explanation for #[must_use] on ResultManish Goregaokar-1/+1
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
2016-09-11Improve Result docggomez-36/+59
2016-09-03Indicate where `core::result::IntoIter` is created.Corey Farwell-1/+7
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-7/+1
2016-08-18Add a FusedIterator trait.Steven Allen-0/+10
This trait can be used to avoid the overhead of a fuse wrapper when an iterator is already well-behaved. Conforming to: RFC 1581 Closes: #35602
2016-08-10Remove redundant `&mut ref mut` in doc for Result::as_mut()Georg Brandl-2/+2
2016-06-29Improve code example for try!Jupp Müller-1/+4
This change improves the code example for try!, avoiding to use try! in the example code that shows what code constructs try! can replace.
2016-04-11Rollup merge of #32854 - GuillaumeGomez:result_doc, r=steveklabnikSteve Klabnik-3/+44
Add some missing commas and missing titles/formatting Fixes #29373. r? @steveklabnik
2016-04-09Add some missing commas and missing titles/formattingGuillaume Gomez-3/+44
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-0/+3
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-23Register new snapshotsAaron Turon-2/+2
2016-01-22Move cold panic functions in Option and ResultUlrik Sverdrup-21/+9
Move functions out of their impl blocks; avoids unnecessary monomorphization by type parameters that are irrelevant to the message output.
2016-01-22Use cold functions for panic formatting Option::expect, Result::unwrap etcUlrik Sverdrup-6/+23
Option::expect, Result::unwrap, unwrap_err, expect These methods are marked inline, but insert a big chunk of formatting code, as well as other error path related code, such as deallocating a std::io::Error if you have one. We can explicitly separate out that code path into a function that is never inline, since the panicking case should always be rare.
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-2/+2
2015-12-10Auto merge of #30182 - alexcrichton:remove-deprecated, r=aturonbors-53/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-53/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10fix missing Panics tag and missing periodLetheed-0/+2
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+2
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+1