#try_collect without the collect

5 messages · Page 1 of 1 (latest)

turbid pine
#

also does the compiler understand this way of doing stuff?

#

try_collect without the collect

#
fn try_flatten<Output, Residual>(
    mut iter: impl Iterator<Item = Result<Output, Residual>>,
) -> Result<impl IntoIterator<Item = Output>, Residual> {
    iter.try_fold(vec![], |mut acc, item| {
        acc.push(item?);
        Ok(acc)
    })
}
#

is try_collect that lies