CountAsync
Consumes an async cursor one awaited step at a time and counts its items. Stops at first EOF or error, destroys discarded owned items normally, and adds no intermediate collection. Task/callback/source costs remain explicit. Count overflow uses ordinary checked arithmetic. A nonterminating source never produces a final count without cancellation or source failure.
Module std.iteration
import std.iteration;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
CountAsync
pub async fn CountAsync<T, E, I>(mut Cursor: I, Token: CancellationToken) -> Task<Result<usize, E>>
where T: Movable where E: Movable where I: TypedAsyncIterator<T, E>, MovableConsumes an async cursor one awaited step at a time and counts its items. Stops at first EOF or error, destroys discarded owned items normally, and adds no intermediate collection. Task/callback/source costs remain explicit. Count overflow uses ordinary checked arithmetic. A nonterminating source never produces a final count without cancellation or source failure. T: Exact Movable item category. E: Movable source error preserved by ownership. I: Movable structural cursor returning the exact typed step task. Cursor: Owned traversal state; explicitly move a named noncopy cursor. Token: Owned cancellation observation copied into each awaited step. Return: Task yielding checked count or the first exact source error. Warning: Stored views/borrowed inputs retain ordinary origin/suspension rules.
CountAsync
pub fn CountAsync<T, E, I>(mut Cursor: I) -> Task<Result<usize, E>>
where T: Movable where E: Movable where I: TypedAsyncIterator<T, E>, MovableSupplies the omitted arguments to CountAsync. Note: Defaults: Token = CancellationToken(). T: Same generic argument and constraints as the full operation. E: Same generic argument and constraints as the full operation. I: Same generic argument and constraints as the full operation. Cursor: Same input, ownership and lifetime contract as the full operation. Return: Exact full-operation result; no additional async frame is created.