]> git.lizzy.rs Git - rust.git/commit
Result::or : avoid over-specializing the type
authorCody P Schafer <dev@codyps.com>
Wed, 25 Feb 2015 18:37:22 +0000 (13:37 -0500)
committerCody P Schafer <dev@codyps.com>
Wed, 25 Feb 2015 22:38:28 +0000 (17:38 -0500)
commit07dc8d67c92017f950eef3951ec901cb2a3add7e
tree1ddc060d09dc610bd642ffef510fc95da28d5574
parent880fb89bde126aa43fc348d0b93839d3d18a1f51
Result::or : avoid over-specializing the type

Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

    fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

    fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings `or` in line with the existing `and` and `or_else` member
types.

This is a
[breaking-change]
Due to some code needing additional type annotations.
src/libcore/result.rs
src/libcoretest/result.rs