tuwunel_core/utils/set/
mod.rs1mod difference_sorted_stream2;
8mod intersection;
9mod intersection_sorted;
10mod intersection_sorted_stream2;
11
12use std::{pin::Pin, task::ready};
13
14use futures::{
15 Stream,
16 task::{Context, Poll},
17};
18
19pub use self::{
20 difference_sorted_stream2::difference_sorted_stream2, intersection::intersection,
21 intersection_sorted::intersection_sorted,
22 intersection_sorted_stream2::intersection_sorted_stream2,
23};
24
25fn poll_head<'p, S, T>(
32 stream: Pin<&mut S>,
33 peeked: &'p mut Option<T>,
34 cx: &mut Context<'_>,
35) -> Poll<Option<&'p T>>
36where
37 S: Stream<Item = T>,
38{
39 if peeked.is_none() {
40 *peeked = ready!(stream.poll_next(cx));
41 }
42
43 Poll::Ready(peeked.as_ref())
44}