MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / collect_until_error

Function collect_until_error

atomic-core/src/pristine/txn/helpers.rs:214–226  ·  view source on GitHub ↗
(
    results: impl IntoIterator<Item = Result<T, E>>,
)

Source from the content-addressed store, hash-verified

212}
213
214pub(crate) fn collect_until_error<T, E>(
215 results: impl IntoIterator<Item = Result<T, E>>,
216) -> Vec<Result<T, E>> {
217 let mut collected = Vec::new();
218 for result in results {
219 let failed = result.is_err();
220 collected.push(result);
221 if failed {
222 break;
223 }
224 }
225 collected
226}
227
228pub(crate) fn try_is_present<T, E>(
229 mut results: impl Iterator<Item = Result<T, E>>,

Callers 3

iter_treeMethod · 0.85
iter_treeMethod · 0.85

Calls 1

pushMethod · 0.45