Async-only chain-based variable lookup engine, support no_std with alloc.
varchain provides a flexible way to resolve variables from a prioritized chain of sources (e.g., in-memory maps, environment variables, network lookups) without enforcing a specific runtime.
- Async-Only: Designed for asynchronous contexts from the ground up, compatible with any runtime (Tokio, async-std, smol, etc.) or just
core::future. - Flexible Sources: Easy implementation of custom sources via the
Sourcetrait. - Composability: Build lookup scopes by chaining multiple sources with strict precedence.
Check the examples directory for runnable code:
- HashMap Source:
examples/hashmap.rs- Simple memory-based lookup. - ahash Source:
examples/ahash.rs- UseAHashMapfor high-performance hashing. - Closure Source:
examples/closure.rs- Use functions for dynamic lookups. - Chained Priority:
examples/chain.rs- Demonstrate fallback and precedence. - Custom Source:
examples/custom_source.rs- Implement theSourcetrait for async backends.
[dependencies]
varchain = { version = "0.1", features = ["full"] }| Feature | Description |
|---|---|
std |
Enables standard library support for hashmap. |
ahash |
Enables ahash::AHashMap support. |
full |
Enables all features above. |
Released under the MIT License © 2026 Canmi