Skip to main content

paginate

Function paginate 

Source
pub fn paginate<'a, T, F, Fut>(fetch: F) -> impl Stream<Item = Result<T>> + 'a
where T: 'a, F: FnMut(Option<String>) -> Fut + 'a, Fut: Future<Output = Result<Page<T>>> + 'a,
Expand description

Lazily streams every item across pages by repeatedly invoking fetch with the previous page’s end_cursor (None on the first call).

Stops when the server reports has_next_page == false, and also treats a repeated end_cursor as the end of the stream — an infinite-loop guard against a misbehaving (or mocked) server.

Complexity note: page size multiplies Linear’s query complexity (single queries are capped at 10,000 points; the server default page size is 50). Prefer modest first values on the underlying request.