feat(pagination): Add ScanAndCollectN to collect at most n results.

Introduce ScanAndCollectN, which works like ScanAndCollect but stops collecting once n items have been gathered. Negative values of n retain the existing "collect all" behaviour, allowing ScanAndCollect to delegate to it. This allows capping search results before they overwhelm callers.

Add example functions demonstrating how to use ScanAndCollectN and Scan2 with guidance when each approach is preferred.

Merge request reports

Loading