Skip to main content

Paginator

Trait Paginator 

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

Automatically streams pages in list RPCs.

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

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.

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 items(self) -> impl ItemPaginator<PageType, Error>

Creates a new ItemPaginator from an existing Paginator.

Source

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

Returns the next mutation of the wrapped stream.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§