Skip to content

Allow MultiUnzip on Result<tuple, E> with behaviour like collect()? #996

Closed
@shahn

Description

@shahn

I haven't found a way to make a pattern like this work:

let inputs = vec![(Ok(1), 2, 3), (Ok(4), 5, 6), (Ok(7), 8, 9)];
    
    let (a, b, c): (Vec<_>, Vec<_>, Vec<_>) = inputs.
        into_iter()
        .map(|(x, y, z)| {
            x.map(|x| (x, y, z))
        })
        .multiunzip()?;

It would be great if this could work like collect() to allow short circuiting on an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions