From 8cdfa445d6629ffef4cb84967ff7017654045bc2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Jul 2025 18:36:06 -0600 Subject: chore: add vendor directory --- vendor/async-stream/src/next.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 vendor/async-stream/src/next.rs (limited to 'vendor/async-stream/src/next.rs') diff --git a/vendor/async-stream/src/next.rs b/vendor/async-stream/src/next.rs new file mode 100644 index 00000000..7b1e0467 --- /dev/null +++ b/vendor/async-stream/src/next.rs @@ -0,0 +1,32 @@ +use futures_core::Stream; +use std::future::Future; +use std::pin::Pin; +use std::task::{Context, Poll}; + +// This is equivalent to the `futures::StreamExt::next` method. +// But we want to make this crate dependency as small as possible, so we define our `next` function. +#[doc(hidden)] +pub fn next(stream: &mut S) -> impl Future> + '_ +where + S: Stream + Unpin, +{ + Next { stream } +} + +#[derive(Debug)] +struct Next<'a, S> { + stream: &'a mut S, +} + +impl Unpin for Next<'_, S> where S: Unpin {} + +impl Future for Next<'_, S> +where + S: Stream + Unpin, +{ + type Output = Option; + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + Pin::new(&mut self.stream).poll_next(cx) + } +} -- cgit v1.2.3