decurse 0.0.4

Macro to make recursive function run on the heap (i.e. no stack overflow).
Documentation
use std::task::Poll;

use std::future::Future;

pub struct PendOnce {
	pended: bool,
}

impl PendOnce {
	pub fn new() -> Self {
		Self { pended: false }
	}
}

impl Future for PendOnce {
	type Output = ();

	fn poll(
		mut self: std::pin::Pin<&mut Self>,
		_: &mut std::task::Context<'_>,
	) -> Poll<Self::Output> {
		if self.pended {
			Poll::Ready(())
		} else {
			self.pended = true;
			Poll::Pending
		}
	}
}