datex_core/utils/async_iterators.rs
1use core::{async_iter::AsyncIterator, future::poll_fn, pin::Pin};
2
3use crate::prelude::*;
4// utility function for async next
5pub async fn async_next_pin_box<I>(iter: &mut Pin<Box<I>>) -> Option<I::Item>
6where
7 I: AsyncIterator + ?Sized,
8{
9 poll_fn(|cx| iter.as_mut().poll_next(cx)).await
10}