Trait PagedFn

Source
pub trait PagedFn<O, C, F, E>: Sized + Fn(Option<C>) -> F
where O: Send, C: Send, F: Future<Output = Result<Page<O, C>, E>> + Send,
{ // Provided methods fn collect<T>(self) -> impl Future<Output = Result<T, E>> where T: Default + Extend<O> { ... } fn stream(self) -> PagedStream<O, C, F, E, Self> { ... } }
Expand description

A helper trait for repeatedly calling an async function which returns pages of data.

Provided Methods§

Source

fn collect<T>(self) -> impl Future<Output = Result<T, E>>
where T: Default + Extend<O>,

Get all items from the source and collect them into a vector.

Source

fn stream(self) -> PagedStream<O, C, F, E, Self>

Get a stream which will return all items from the source.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<O, C, F, E, Fun> PagedFn<O, C, F, E> for Fun
where Fun: Fn(Option<C>) -> F, O: Send, C: Send, F: Future<Output = Result<Page<O, C>, E>> + Send,