Skip to main content

ItemPaginator

Trait ItemPaginator 

Source
pub trait ItemPaginator<PageType, Error>: Send + Paginator
where PageType: PageableResponse,
{ // Required method fn next( &mut self, ) -> impl Future<Output = Option<Result<PageType::PageItem, Error>>> + Send; }
Expand description

Automatically stream items in list RPCs.

When listing large collections of items Google Cloud services typically break the responses in “pages”, where each page contains a subset of the items, and a token to request the next page. The caller must repeatedly call the list RPC using the token from the previous page.

Sequencing these calls can be tedious. The Google Cloud client libraries for rust provide implementations of this trait to simplify the use of these paginated APIs.

Many applications want to operate on one item at a time. The Google Cloud client libraries for Rust provide implementations of this trait that automatically iterate over each item and then fetch the next page, stopping when all the pages are processed.

Enable the unstable-stream feature to convert this type to a Stream.

For more information on the RPCs with paginated responses see AIP-4233.

Required Methods§

Source

fn next( &mut self, ) -> impl Future<Output = Option<Result<PageType::PageItem, Error>>> + Send

Returns the next item from the stream of (paginated) responses.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§