Partitioning and mapping as one operation?

    let impostor_results = self.do_select(params)?;
    //  Now separate the good results from the errors.
    let (items, errors) : (Vec<_>, Vec<_>) = impostor_results
        .into_iter()
        .partition(|item: &Result<_,_>| item.is_ok());
    let items: Vec<RegionImpostorData> = items.into_iter().map(|item: Result<_,_>| item.ok().unwrap()).collect();
    let errors: Vec<Error> = errors.into_iter().map(|item: Result<_,_>| item.err().unwrap()).collect();
    if !errors.is_empty() {
        log::error!("Impostor download fetch errors: {:?}", errors);
    }
    let json = serde_json::to_string(&items)?;

do_select returns a Vec<Result<Item, Error>>. It's a database read with some validation.
The .partition will separate the OK and Err results. But what comes out is two vectors of Result items, one all Ok and one all Err. So another pass over the data is necessary to strip the Result struct. Is there a a more elegant way to do this? Can those iterators be chained?

You probably want itertools' partition_result helper. It's also small enough that you could copy it into your own code easily enough, and the license allows that.

Note that partition_result uses itertools' partition_map utility, which is the more general version of what OP is asking for. Luckily that can also be implemented pretty easily.

Makes sense. Someone else already hit this problem and put the fix into a crate.