]> git.lizzy.rs Git - rust.git/commit
impl FromIterator<()> for ()
authorJosh Stone <jistone@redhat.com>
Thu, 19 Oct 2017 06:12:37 +0000 (23:12 -0700)
committerJosh Stone <jistone@redhat.com>
Thu, 19 Oct 2017 06:12:37 +0000 (23:12 -0700)
commit68d05b2a073d2679ec1621ea1ebc49b7814cf250
tree8ab664f4a4f9833cc0c97c8a9cbfe2f204d51b65
parentb7960878ba77124505aabe7dc99d0a898354c326
impl FromIterator<()> for ()

This just collapses all unit items from an iterator into one.  This is
more useful when combined with higher-level abstractions, like
collecting to a `Result<(), E>` where you only care about errors:

```rust
use std::io::*;
data = vec![1, 2, 3, 4, 5];
let res: Result<()> = data.iter()
    .map(|x| writeln!(stdout(), "{}", x))
    .collect();
assert!(res.is_ok());
```
src/libcore/lib.rs
src/libcore/unit.rs [new file with mode: 0644]