product-os-async-executor 0.0.20

Product OS : Async Executor provides a set of tools to handle async execution generically so that the desired async library (e.g. tokio, smol) to be used can be chosen at compile time.
Documentation
#![cfg(feature = "exec_async_std")]
#![allow(deprecated)]

use product_os_async_executor::{AsyncStdExecutor, Executor, ExecutorPerform, Timer};

#[test]
fn test_async_std_executor_context() {
    async_std::task::block_on(async {
        let executor = AsyncStdExecutor::context().await;
        assert!(executor.is_ok());
    });
}

#[test]
fn test_async_std_executor_spawn_in_context() {
    async_std::task::block_on(async {
        let result = AsyncStdExecutor::spawn_in_context(async { 42 }).await;
        assert!(result.is_ok());
    });
}

#[test]
fn test_async_std_executor_spawn_from_executor() {
    async_std::task::block_on(async {
        let executor = AsyncStdExecutor::context().await.unwrap();
        let result = AsyncStdExecutor::spawn_from_executor(&executor, async { "hello" }).await;
        assert!(result.is_ok());
    });
}

#[test]
fn test_async_std_timer_once() {
    async_std::task::block_on(async {
        let mut timer = AsyncStdExecutor::once(50).await;
        let elapsed = timer.tick().await;
        assert!(elapsed > 0);
    });
}

#[test]
fn test_async_std_timer_interval() {
    async_std::task::block_on(async {
        let mut timer = AsyncStdExecutor::interval(50).await;
        let _first_tick = timer.tick().await;
        let _second_tick = timer.tick().await;
    });
}

#[test]
fn test_async_std_timer_cancel() {
    async_std::task::block_on(async {
        let mut timer = AsyncStdExecutor::interval(100).await;
        timer.cancel().await;
    });
}

#[test]
fn test_async_std_executor_clone() {
    async_std::task::block_on(async {
        let executor = AsyncStdExecutor::context().await.unwrap();
        let _cloned = executor.clone();
    });
}

#[test]
fn test_async_std_sync_operations() {
    let executor = AsyncStdExecutor::context_sync();
    assert!(executor.is_ok());

    let result = AsyncStdExecutor::spawn_in_context_sync(async { 99 });
    assert!(result.is_ok());
}

#[test]
fn test_async_std_timer_sync() {
    let _timer = AsyncStdExecutor::once_sync(100);
    let _timer2 = AsyncStdExecutor::interval_sync(50);
}

#[test]
fn test_async_std_multiple_spawns() {
    async_std::task::block_on(async {
        for i in 0..5 {
            let result = AsyncStdExecutor::spawn_in_context(async move { i * 4 }).await;
            assert!(result.is_ok());
        }
    });
}

#[test]
fn test_async_std_enter_context() {
    async_std::task::block_on(async {
        let executor = AsyncStdExecutor::context().await.unwrap();
        executor.enter_context().await;
        // Should not panic (no-op for async-std)
    });
}