agnostic is an agnostic abstraction layer for any async runtime.
If you want a light weight crate, see agnostic-lite.
Introduction
agnostic is a comprehensive, runtime-agnostic abstraction layer for async Rust. It provides a unified API for task spawning, networking, DNS resolution, process management, and QUIC protocol support - all working seamlessly with tokio, or smol.
Looking for a lightweight option? Check out agnostic-lite for a minimal, no_std-compatible core.
Features
- Task Management: Spawn tasks globally or locally
- Time Operations: Sleep, intervals, timeouts, and delays
- Networking: TCP listeners/streams and UDP sockets
- DNS Resolution: Multiple transports (DoH, DoT, DoQ, DoH3) with DNSSEC
- Process Management: Spawn and manage subprocesses
- QUIC Support: Quinn protocol integration
- Runtime Agnostic: Switch runtimes with a single feature flag
- Zero-Cost: Compiles to runtime-specific code
Installation
[]
= "0.8"
Runtime Selection
Choose one runtime feature:
# For tokio
= { = "0.8", = ["tokio"] }
# For smol
= { = "0.8", = ["smol"] }
Optional Features
# Enable networking
= { = "0.8", = ["tokio", "net"] }
# Enable DNS resolution
= { = "0.8", = ["tokio", "dns"] }
# Enable DNS over HTTPS with rustls
= { = "0.8", = ["tokio", "dns-over-https-rustls"] }
# Enable DNS over QUIC
= { = "0.8", = ["tokio", "dns-over-quic"] }
# Enable DNSSEC
= { = "0.8", = ["tokio", "dnssec-ring"] }
# Enable process management
= { = "0.8", = ["tokio", "process"] }
# Enable Quinn QUIC
= { = "0.8", = ["tokio", "quinn"] }
Feature Flags
Core Features
std(default): Standard library supportalloc: Allocation support
Runtime Features (choose one)
tokio: Tokio runtime supportsmol: Smol runtime support
Component Features
net: Network abstractions (TCP, UDP)dns: DNS resolution supportprocess: Process spawning and managementquinn: Quinn QUIC protocol supporttokio-io: Tokio I/O trait compatibility
DNS Transport Features
dns-over-quic: DNS over QUIC (RFC 9250)dns-over-h3: DNS over HTTP/3dns-over-https-rustls: DNS over HTTPS with rustlsdns-over-rustls: DNS over TLS with rustlsdns-over-openssl: DNS over TLS with OpenSSLdns-over-native-tls: DNS over TLS with native-tlsdns-webpki-roots: Use webpki root certificatesdns-native-certs: Use OS native certificates
DNSSEC Features
dnssec: Basic DNSSEC supportdnssec-openssl: DNSSEC with OpenSSLdnssec-ring: DNSSEC with ring crypto library
Comparison: agnostic vs agnostic-lite
| Feature | agnostic | agnostic-lite |
|---|---|---|
| Task spawning | ✅ | ✅ |
| Time operations | ✅ | ✅ |
| Networking | ✅ | ❌ |
| DNS resolution | ✅ | ❌ |
| Process management | ✅ | ❌ |
| QUIC support | ✅ | ❌ |
no_std support |
❌ | ✅ |
| Alloc-free | ❌ | ✅ |
| No unsafe code | ❌ | ✅ |
Use agnostic-lite when:
- You need
no_stdor embedded support - You want minimal dependencies
- You only need basic async primitives
Use agnostic when:
- You need networking, DNS, or process capabilities
- You're building standard applications
- You want a batteries-included experience
License
agnostic 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) 2025 Al Liu.