Expand description
Agnostic-Lite
agnostic-lite
is WASM friendly and light version of agnostic
, for users who want to write async runtime-agnostic crate.
English | 简体中文
§Introduction
agnostic-lite
is WASM friendly and light version of agnostic
, for users who want to write async runtime-agnostic crate.
agnostic-lite
splits the big Runtime
trait in agnostic
in multiple small traits:
AsyncSpawner
: trait for spawning tasksAsyncLocalSpawner
: trait for spawning local tasksAsyncSleep
: trait for sleep functionalityAsyncInterval
: trait for interval functionalityAsyncTimeout
: trait for timeout functionality
Builtin supports runtimes:
tokio
async-std
smol
wasm-bindgen-futures
§Installation
[dependencies]
agnostic-lite = "0.2"
§License
agnostic-lite
is under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT for details.
Copyright (c) 2024 Al Liu.
Modules§
- async_
io async-io
- async_
std async-std
Concrete runtime implementations based onasync-std
runtime. - smol
smol
Concrete runtime implementations based onsmol
runtime. - tests
test
ortest
Unit test for theRuntimeLite
- time
time
Time related traits - tokio
tokio
Concrete runtime implementations based ontokio
runtime. - wasm
wasm
Concrete runtime implementations based onwasm-bindgen-futures
.
Enums§
- After
Handle Error time
Error ofAfterHandle
’s output
Traits§
- After
Handle time
The handle returned by theAsyncAfterSpawner
when a after future is spawned. - A spawner trait for spawning futures. Go’s
time.AfterFunc
equivalent. - A spawner trait for spawning blocking.
- A spawner trait for spawning futures locally. Go’s
time.AfterFunc
equivalent. - A spawner trait for spawning futures.
- A spawner trait for spawning futures.
- Detaches the task related to the join handle to let it keep running in the background.
- Local
After Handle time
The handle returned by theAsyncLocalAfterSpawner
when a after future is spawned. - Runtime trait
- Yielder hints the runtime to execution back