about summary refs log tree commit diff
path: root/src/libstd/result.rs
AgeCommit message (Collapse)AuthorLines
2014-05-15core: Implement unwrap()/unwrap_err() on ResultAlex Crichton-312/+0
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-09doc: Fix some broken linksAlex Crichton-2/+2
2014-05-07core: Add unwrap()/unwrap_err() methods to ResultAlex Crichton-0/+312
These implementations must live in libstd right now because the fmt module has not been migrated yet. This will occur in a later PR. Just to be clear, there are new extension traits, but they are not necessary once the std::fmt module has migrated to libcore, which is a planned migration in the future.
2014-05-07core: Inherit the result moduleAlex Crichton-783/+0
The unwrap()/unwrap_err() methods are temporarily removed, and will be added back in the next commit.
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-2/+2
2014-04-23Fix other bugs with new closure borrowingAlex Crichton-4/+4
This fixes various issues throughout the standard distribution and tests.
2014-04-21Fix misspellings in comments.Joseph Crail-2/+2
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-25/+30
2014-04-17Add #[deriving(Hash)] to Result.Richard Diamond-1/+1
2014-04-16doc: Address review feedbackBrian Anderson-17/+14
2014-04-16std: Improve docs for mod 'result'Brian Anderson-5/+328
2014-04-13Make Result::{unwrap, unwrap_err} require ShowSteven Fackler-14/+19
`foo.ok().unwrap()` and `foo.err().unwrap()` are the fallbacks for types that aren't `Show`. Closes #13379
2014-04-12libstd: Add unwrap_or and unwrap_or_handle to ResultKevin Butler-0/+61
2014-03-30Rename `from_iterator` to `from_iter` for consistency.Brian Anderson-1/+1
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-1/+1
value
2014-03-08Removed DeepClone. Issue #12698.Michael Darakananda-1/+1
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-18/+1
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-08std::fmt: convert the formatting traits to a proper self.Huon Wilson-2/+2
Poly and String have polymorphic `impl`s and so require different method names.
2014-02-03std: Remove io::io_errorAlex Crichton-1/+1
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
2014-02-02std: rename fmt::Default to `Show`.Huon Wilson-1/+1
This is a better name with which to have a #[deriving] mode. Decision in: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-01-28
2014-01-31Fix minor doc typosVirgile Andreani-2/+2
2014-01-29Flag Result as #[must_use] and deal with fallout.Alex Crichton-0/+1
2014-01-25Uppercase numeric constantsChris Wong-2/+2
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-2/+1
2013-12-29auto merge of #11134 : lucab/rust/lucab/libstd-doc, r=cmrbors-1/+1
Uniform the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index.
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-26std: result::collect to take an iterator, add option::collectErick Tryzelaar-28/+32
2013-12-14Remove {As,Into,To}{Option,Either,Result} traits.Chris Morgan-132/+0
Expanded, that is: - `AsOption` - `IntoOption` - `ToOption` - `AsEither` - `IntoEither` - `ToEither` - `AsResult` - `IntoResult` - `ToResult` These were defined for each other but never *used* anywhere. They are all trivial and so removal will have negligible effect upon anyone. `Either` has fallen out of favour (and its implementation of these traits of dubious semantics), `Option<T>` → `Result<T, ()>` was never really useful and `Result<T, E>` → `Option<T>` should now be done with `Result.ok()` (mirrored with `Result.err()` for even more usefulness). In summary, there's really no point in any of these remaining.
2013-12-06Made Results API more composableMarvin Löbel-124/+43
2013-11-28Register new snapshotsAlex Crichton-2/+2
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-6/+6
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-10/+10
2013-11-01Fixed unused import warning in testsMarvin Löbel-1/+1
2013-11-01Removed legacy implementationsMarvin Löbel-60/+0
2013-11-01Cleaned up the option and result module in more detailMarvin Löbel-21/+12
Made both types implement more standard traits in a nicer way Derived more traits
2013-11-01Reordered the methods in std::Option and std::ResultMarvin Löbel-169/+154
Cleaned up the source in a few places Renamed `map_move` to `map`, removed other `map` methods Added `as_ref` and `as_mut` adapters to `Result` Added `fmt::Default` impl
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-6/+6
Who doesn't like a massive renaming?
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-1/+0
2013-10-16Added Result implementations for ToStr and fmt::DefaultMarvin Löbel-6/+47
2013-09-30std: Remove usage of fmt!Alex Crichton-6/+8
2013-09-22std::result: Remove function `map_opt`blake2-ppc-13/+0
This function has never had any users in the tree
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-10/+55
2013-09-12std: Add ToEither/IntoEither/AsEitherErick Tryzelaar-21/+58
2013-09-12std: Add ToResult/IntoResult/AsResultErick Tryzelaar-0/+68
2013-09-12std: Add ToOption/IntoOption/AsOptionErick Tryzelaar-0/+60
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-2/+2
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-08-18auto merge of #8551 : huonw/rust/speling, r=alexcrichtonbors-1/+1
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-16doc: correct spelling in documentation.Huon Wilson-1/+1
2013-08-15std: Replace map_vec, map_vec2, iter_vec2 in std::resultblake2-ppc-55/+84
Replace these with three functions based on iterators: collect, fold, and fold_. The mapping part is replaced by iterator .map(), so the part that these functions do is to accumulate the final Result<,> value. * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-2/+2
cc #7887