summary refs log tree commit diff
path: root/src/libcore/result.rs
AgeCommit message (Collapse)AuthorLines
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
2015-11-12Auto merge of #29544 - Ryman:reduce_doc_warnings, r=steveklabnikbors-0/+6
Did this alphabetically, so I didn't see [how `std` was doing things](https://dxr.mozilla.org/rust/source/src/libstd/lib.rs#215) till I was nearly finished. If you prefer to add crate-level-whitelists like std instead of test-level, I can rebase with that strategy. A number of these commits can probably be dropped as the crates don't have much to test, and are deprecated. Let me know which if any to drop! (can also squash after review if desired) r? @steveklabnik
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+6
2015-11-12Fix article in Result.map and Result.map_err documentationDanilo Bargen-2/+2
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-3/+0
Remove `stable` stability annotations from inherent impls
2015-11-01Stop using ok().expect() in Result docsFlorian Hartwig-4/+3
2015-10-25std: Stabilize library APIs for 1.5Alex Crichton-0/+2
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-09-16Simplify sample code for {Option, Result}::iter_mutAdolfo Ochagavía-1/+1
Fixes #28431
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-3/+4
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-08-27core: Implement IntoIterator for Option and Result referencesGeorg Brandl-0/+20
Fixes #27996.