Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment count

std/flow::count


Generics

◻ T (any)

Inputs

⇥ stream: Stream<T>

Outputs

↦ count: Stream<u128>


Gives count of elements passing through stream.

This count increment one for each element within the stream, starting at 1.

graph LR
     T("count()")
     V["🟦 🟦 🟦 …"] -->|iter| T
     
     T -->|count| P["1️⃣ 2️⃣ 3️⃣ …"]

     style V fill:#ffff,stroke:#ffff
     style P fill:#ffff,stroke:#ffff