about summary refs log tree commit diff
path: root/src/libcore/option.rs
AgeCommit message (Collapse)AuthorLines
2017-04-01Improve docs of core::option::IntoIterIrfan Hudda-1/+7
2017-03-20Add missing urls in Option enumGuillaume Gomez-4/+13
2017-02-05Rollup merge of #39289 - shahn:option_entry, r=alexcrichtonCorey Farwell-0/+70
Provide Entry-like API for Option This implements #39288. I am wondering whether to use std::intrinsics::unreachable!() here. Both seems fine to me (the second match optimizes away in release mode).
2017-02-05Provide Entry-like API for OptionSebastian Hahn-0/+70
This implements #39288. Thanks to @steveklabnik and @oli-obk for their review comments :)
2017-01-30doc: minor Option improvementsTshepang Lekhonkhobe-3/+3
2016-11-30Add cloned example for OptionGuillaume Gomez-0/+10
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-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-20Implement TrustedLen for more iteratorsUlrik Sverdrup-1/+10
2016-09-19fixed the safety header/wording in option.rsjacobpadkins-6/+4
2016-09-14Rollup merge of #36396 - athulappadan:Default-docs, r=blussGuillaume Gomez-0/+1
Documentation of what Default does for each type Addresses #36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
2016-09-11Documentation for default types modifiedathulappadan-1/+1
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-09-11Improve Option docggomez-28/+50
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-10/+1
2016-08-18Add a FusedIterator trait.Steven Allen-2/+12
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-07-20core: impl From<T> for Option<T>Sean McArthur-0/+8
2016-04-12Remove unused trait importsSeo Sanghyeon-1/+0
2016-03-24Improve some Option code exampleGuillaume Gomez-7/+3
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-2/+4
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-23Register new snapshotsAaron Turon-1/+1
2016-01-22Move cold panic functions in Option and ResultUlrik Sverdrup-7/+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-1/+7
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-1/+1
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-1/+1
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+2
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+1
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-2/+0
Remove `stable` stability annotations from inherent impls
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-10-07Alter formatting for words in Option::cloned doc commentCorey Farwell-1/+2
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-1/+3
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-09-03Elide lifetimes in libcoreManish Goregaokar-4/+4
2015-08-27core: Implement IntoIterator for Option and Result referencesGeorg Brandl-0/+20
Fixes #27996.
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-2/+4
2015-07-27Show appropriate feature flags in docsSteve Klabnik-1/+2
2015-07-05option: obey idiom of leaving behind a trailing comma in match blocksTshepang Lekhonkhobe-15/+15
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-1/+1
2015-06-17core: Split apart the global `core` featureAlex Crichton-1/+1
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-1/+1
Pull request for #26188.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-1/+1
2015-06-10core: impl Clone for option::IntoIter and iter::OnceUlrik Sverdrup-0/+1
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-3/+0
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-02Rollup merge of #25920 - tshepang:option-map-example, r=GankroManish Goregaokar-3/+5
2015-06-01doc: improve Option::map exampleTshepang Lekhonkhobe-3/+5
2015-06-01Auto merge of #25923 - tshepang:patch-1, r=Gankrobors-1/+1