storage_zip
This crate offers utility functions for zipping Options and Results into tuples.
It is instead to be used when different actions yields Options or Results values but the program flow can only proceed if all of them are Some or Ok. When used with Result, it requires that all the Results being zipped have the same error type and it will evaluate to the first error or to the tuple with all the Ok values.
With the crate you can do:
use OptionZip;
let option_value_one = Some;
let option_value_two = Some;
let zipped_options = Option zip;
assert_eq!;
The crate also provides zip functions with more arguments:
use ResultZip;
use File;
use io;
let f1 = open;
let f2 = open;
let f3 = open;
let zipped_result: = Result zip3;
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.