tears 0.10.2

A simple and elegant framework for building TUI applications using The Elm Architecture (TEA)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Shared poll-once-with-noop-waker support.
//!
//! Several call sites need to poll a future or stream exactly once, without an
//! executor, to check whether it is ready right now: a wake-up scheduled
//! during that single poll is deliberately not honored, since nothing is
//! listening for it.

use std::task::Context;

use futures::task::noop_waker_ref;

/// A [`Context`] whose waker discards every wake-up. Building one costs
/// nothing (the waker is a static no-op vtable), so callers construct a fresh
/// one per poll rather than holding it across calls.
pub fn noop_context() -> Context<'static> {
    Context::from_waker(noop_waker_ref())
}