summary refs log tree commit diff
path: root/src/libcore/result.rs
AgeCommit message (Collapse)AuthorLines
2014-10-07Reinstate AsSlice impls for Option and ResultNick Cameron-0/+21
2014-10-07Rename slice::SliceNick Cameron-21/+0
2014-09-17doc: Methods for result::Result.Jonas Hietala-28/+228
2014-09-17doc: Cleanup.Jonas Hietala-27/+27
Remove ~~~ for code block specification. Use /// Over /** */ for doc blocks.
2014-09-16Align with _mut conventionsAaron Turon-2/+14
As per [RFC 52](https://github.com/rust-lang/rfcs/blob/master/active/0052-ownership-variants.md), use `_mut` suffixes to mark mutable variants, and `into_iter` for moving iterators. [breaking-change]
2014-08-28stabilize core::resultAaron Turon-41/+173
Per API meeting https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues. * `collect`: this functionality is being moved to a new `FromIterator` impl. * `fold_` is deprecated due to lack of use * Several methods found in `core::option` are added here, including `iter`, `as_slice`, and variants. Due to deprecations, this is a: [breaking-change]
2014-07-14Document that Result.unwrap prints the Err's valuemasklinn-2/+8
It is implied by the Show bound, but that implication can be missed.
2014-07-04Fixed Result type parameters in doc comment.Zbigniew Siciarz-1/+1
2014-06-30auto merge of #15256 : erickt/rust/optimizations, r=alexcrichtonbors-10/+22
The bug #11084 causes `option::collect` and `result::collect` about twice as slower as it should because llvm is having some trouble optimizing away the scan closure. This gets rid of it so now those functions perform equivalent to a hand written version. This also adds an impl of `Default` for `Rc` along the way.
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-163/+0
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
2014-06-29core: optimize {option,result}::collectErick Tryzelaar-10/+22
The bug #11084 causes these collect functions to run about twice as slow as they should because llvm is having trouble optimizing away the closure for some reason. This patch works around that performance bug by using a simple adapter iterator explicitly for capturing if the outer iterator returns an error.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-13/+13
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-17change ~[] -> Vec for collect()Nathan Typanski-7/+11
This updates the documentation for result::collect() and option::collect() to use the new-style syntax for vectors, instead of the old ~[]. Also updates the code blocks for these docs so they will be tested automatically. closes #14991
2014-06-10Fix more misspelled comments and strings.Joseph Crail-1/+1
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-1/+1
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-06-01auto merge of #14580 : utkarshkukreti/rust/fix-docs-for-result-map, ↵bors-1/+3
r=alexcrichton `reader.read_line()` includes trailing newline char, which makes `from_str` always return `None`.
2014-06-01Fix docs for `core::result::Result::map`.Utkarsh Kukreti-1/+3
`reader.read_line()` includes trailing newline char, which makes `from_str` always return `None`.
2014-05-31doc: Fix a number of broken linksAlex Crichton-2/+2
cc #14515
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-2/+2
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-29std: Recreate a `rand` moduleAlex Crichton-2/+1
This commit shuffles around some of the `rand` code, along with some reorganization. The new state of the world is as follows: * The librand crate now only depends on libcore. This interface is experimental. * The standard library has a new module, `std::rand`. This interface will eventually become stable. Unfortunately, this entailed more of a breaking change than just shuffling some names around. The following breaking changes were made to the rand library: * Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which will return an infinite stream of random values. Previous behavior can be regained with `rng.gen_iter().take(n).collect()` * Rng::gen_ascii_str() was removed. This has been replaced with Rng::gen_ascii_chars() which will return an infinite stream of random ascii characters. Similarly to gen_iter(), previous behavior can be emulated with `rng.gen_ascii_chars().take(n).collect()` * {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all relied on being able to use an OSRng for seeding, but this is no longer available in librand (where these types are defined). To retain the same functionality, these types now implement the `Rand` trait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. * Rand implementations for `Box<T>` and `@T` were removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not supported. If this is undesirable, librand can depend on liballoc and regain these implementations. * The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`, but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice structure now has a lifetime associated with it. * The `sample` method on `Rng` has been moved to a top-level function in the `rand` module due to its dependence on `Vec`. cc #13851 [breaking-change]
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-4/+4
[breaking-change]
2014-05-22auto merge of #14357 : huonw/rust/spelling, r=pnkfelixbors-1/+1
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`. ```rust //! a //! b fn bar() {} ```
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-52/+61
[breaking-change]
2014-05-22Spelling/doc formatting fixes.Huon Wilson-1/+1
2014-05-19Rename Result.unwrap_or_handle() to .unwrap_or_else()Kevin Ballard-4/+11
Result.unwrap_or_handle() is the equivalent of Option.unwrap_or_else(). In the interests of naming consistency, call it the same thing. [breaking-change]
2014-05-15core: Update all tests for fmt movementAlex Crichton-21/+19
2014-05-15core: Derive Show impls wherever possibleAlex Crichton-1/+1
These were temporarily moved to explicit implementations, but now that fmt is in core it's possible to derive again.
2014-05-15core: Implement unwrap()/unwrap_err() on ResultAlex Crichton-0/+29
Now that std::fmt is in libcore, it's possible to implement this as an inherit method rather than through extension traits. This commit also tweaks the failure interface of libcore to libstd to what it should be, one method taking &fmt::Arguments
2014-05-10auto merge of #14068 : alexcrichton/rust/rustdoc-xcrate-links, r=brsonbors-1/+1
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-09doc: Fix some broken linksAlex Crichton-1/+1
2014-05-08Handle fallout in iter, option, result, and sync::arcKevin Ballard-7/+7
API changes: - UnsafeArc::newN() returns Vec<UnsafeArc<T>>
2014-05-07core: Get coretest workingAlex Crichton-5/+3
This mostly involved frobbing imports between realstd, realcore, and the core being test. Some of the imports are a little counterintuitive, but it mainly focuses around libcore's types not implementing Show while libstd's types implement Show.
2014-05-07core: Inherit the result moduleAlex Crichton-0/+754
The unwrap()/unwrap_err() methods are temporarily removed, and will be added back in the next commit.
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-456/+0
This only changes the directory names; it does not change the "real" metadata names.
2013-05-19Use assert_eq! rather than assert! where possibleCorey Richardson-7/+7
2013-05-14Use static string with fail!() and remove fail!(fmt!())Björn Steinbrink-5/+5
fail!() used to require owned strings but can handle static strings now. Also, it can pass its arguments to fmt!() on its own, no need for the caller to call fmt!() itself.
2013-05-13Remove re-exports from libcore/core.rcAlex Crichton-0/+2
Also fix up all the fallout elsewhere throughout core. It's really nice being able to have the prelude.
2013-05-09libcore: rename vec::each(variable) to variable.eachYoungmin Yoo-1/+1
2013-05-04Register snapshotsBrian Anderson-7/+0
2013-04-25Rename vec::mod2 to vec::mod_zipCorey Richardson-1/+1
2013-04-10core: changes in response to #5656Niko Matsakis-0/+7
2013-04-08Removing no longer needed unsafe blocksAlex Crichton-4/+2
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-14/+14
2013-03-26librustc: Modify all code to use new lifetime binder syntaxPatrick Walton-1/+1
2013-03-23core: derive Clone for core typesAndrew Paseltiner-1/+1
2013-03-22libcore: Remove `pure` from libcore. rs=depurePatrick Walton-27/+27
2013-03-22core: replace uses of old deriving attribute with new oneAndrew Paseltiner-1/+1
2013-03-18librustc: Convert all uses of old lifetime notation to new lifetime ↵Patrick Walton-2/+2
notation. rs=delifetiming
2013-03-11librustc: Replace all uses of `fn()` with `&fn()`. rs=defunPatrick Walton-16/+16
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-14/+14