Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个Iterator<Item=io::Result<u8>>我想转换为io::Result<Vec<u8>>.
Iterator<Item=io::Result<u8>>
io::Result<Vec<u8>>
iter.map(|x| x.unwrap()).collect::<Vec<u8>>()
会给我,但是如果出现错误,我该Vec<u8>如何保留零件?Err
Vec<u8>
Err
@aspex 谢谢你的帮助,它是
let fold: io::Result<Vec<_>> = iter.collect();