dfir_pipes/pull/
pending.rs1use core::marker::PhantomData;
2use core::pin::Pin;
3
4use crate::pull::{FusedPull, Pull, PullStep, fuse_self};
5use crate::{No, Yes};
6
7#[must_use = "`Pull`s do nothing unless polled"]
9#[derive(Clone, Debug)]
10pub struct Pending<Item> {
11 _phantom: PhantomData<Item>,
12}
13
14impl<Item> Pending<Item> {
15 pub(crate) const fn new() -> Self {
16 Self {
17 _phantom: PhantomData,
18 }
19 }
20}
21
22impl<Item> Default for Pending<Item> {
23 fn default() -> Self {
24 Self::new()
25 }
26}
27
28impl<Item> Unpin for Pending<Item> {}
29
30impl<Item> Pull for Pending<Item> {
31 type Ctx<'ctx> = ();
32
33 type Item = Item;
34 type Meta = ();
35 type CanPend = Yes;
36 type CanEnd = No;
37
38 fn pull(
39 self: Pin<&mut Self>,
40 _ctx: &mut Self::Ctx<'_>,
41 ) -> PullStep<Self::Item, Self::Meta, Self::CanPend, Self::CanEnd> {
42 PullStep::Pending(Yes)
43 }
44
45 fn size_hint(&self) -> (usize, Option<usize>) {
46 (0, Some(0))
47 }
48
49 fuse_self!();
50}
51
52impl<Item> FusedPull for Pending<Item> {}