ic-backup 0.63.2

Host-side snapshot backup and same-release recovery for Internet Computer canisters
Documentation
//! Poll immediate in-memory fixtures; never drive simulator IO.

use futures_util::FutureExt;
use std::{
    future::Future,
    pin::Pin,
    task::{Context, Waker},
};

/// Immediate fixtures must finish on their first poll; this is not an async executor.
pub fn ready<F: Future>(future: F) -> F::Output {
    future
        .now_or_never()
        .expect("fixture unexpectedly requires an async executor")
}

/// Poll one borrowed fixture future; the caller retains ownership and chooses when to cancel.
pub fn assert_pending<F: Future + ?Sized>(future: Pin<&mut F>) {
    assert!(
        future
            .poll(&mut Context::from_waker(Waker::noop()))
            .is_pending(),
        "fixture unexpectedly completed"
    );
}