Struct aws_smithy_async::future::pagination_stream::TryFlatMap
source · pub struct TryFlatMap<Page, Err>(/* private fields */);
Expand description
Utility wrapper to flatten paginated results
When flattening paginated results, it’s most convenient to produce an iterator where the Result
is present in each item. This provides items()
which can wrap an stream of Result<Page, Err>
and produce a stream of Result<Item, Err>
.
Implementations§
source§impl<Page, Err> TryFlatMap<Page, Err>
impl<Page, Err> TryFlatMap<Page, Err>
sourcepub fn new(stream: PaginationStream<Result<Page, Err>>) -> Self
pub fn new(stream: PaginationStream<Result<Page, Err>>) -> Self
Creates a TryFlatMap
that wraps the input.
sourcepub fn flat_map<M, Item, Iter>(
self,
map: M
) -> PaginationStream<Result<Item, Err>>where
Page: Send + 'static,
Err: Send + 'static,
M: Fn(Page) -> Iter + Send + 'static,
Item: Send + 'static,
Iter: IntoIterator<Item = Item> + Send,
<Iter as IntoIterator>::IntoIter: Send,
pub fn flat_map<M, Item, Iter>(
self,
map: M
) -> PaginationStream<Result<Item, Err>>where
Page: Send + 'static,
Err: Send + 'static,
M: Fn(Page) -> Iter + Send + 'static,
Item: Send + 'static,
Iter: IntoIterator<Item = Item> + Send,
<Iter as IntoIterator>::IntoIter: Send,
Produces a new PaginationStream
by mapping this stream with map
then flattening the result.
Trait Implementations§
Auto Trait Implementations§
impl<Page, Err> Freeze for TryFlatMap<Page, Err>
impl<Page, Err> !RefUnwindSafe for TryFlatMap<Page, Err>
impl<Page, Err> Send for TryFlatMap<Page, Err>
impl<Page, Err> !Sync for TryFlatMap<Page, Err>
impl<Page, Err> Unpin for TryFlatMap<Page, Err>
impl<Page, Err> !UnwindSafe for TryFlatMap<Page, Err>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more