karyon core
Core building blocks shared by all karyon crates: a runtime-agnostic async layer (smol or tokio behind one API), async utilities (task groups, queues, condition variables, timeouts, backoff), and optional crypto and testing helpers.
Install
Example
use Duration;
use ;
async
async ;
Feature Flags
| Feature | Description |
|---|---|
smol |
Use smol async runtime (default) |
tokio |
Use tokio async runtime |
crypto |
Ed25519 key pairs: generate, sign, verify |
testing |
Async test runners with executors and timeouts |
Exactly one runtime feature (smol or tokio) must be enabled.
# Default (smol)
= "1.0"
# With crypto
= { = "1.0", = ["crypto"] }
# Tokio runtime
= { = "1.0", = false, = ["tokio"] }
Modules
async_runtime
One API over smol or tokio: Executor / global_executor(),
spawn() / Task, async locks (Mutex, RwLock, OnceCell), io
traits, and net types. karyon does not drive your executor; the
caller owns the runtime.
async_util
TaskGroup (spawn, track, cancel tasks), AsyncQueue (bounded
queue), CondVar / CondWait, select(), timeout(), sleep(),
and Backoff.
crypto (feature crypto)
KeyPair and PublicKey: generate, sign, verify. Ed25519 only for now.
util
random_16() / random_32() / random_64(): random integers.