agnostic

Crates.ioagnostic
lib.rsagnostic
version0.8.0
created_at2023-06-14 18:55:39.285735+00
updated_at2025-11-04 03:05:17.134681+00
descriptionAn agnostic abstraction layer for any async runtime.
homepagehttps://github.com/al8n/agnostic
repositoryhttps://github.com/al8n/agnostic
max_upload_size
id890435
size82,691
Al Liu (al8n)

documentation

https://docs.rs/agnostic

README

Agnostic

agnostic is an agnostic abstraction layer for any async runtime.

If you want a light weight crate, see agnostic-lite.

github LoC Build codecov

docs.rs crates.io crates.io license

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

[dependencies]
agnostic = "0.8"

Runtime Selection

Choose one runtime feature:

# For tokio
agnostic = { version = "0.8", features = ["tokio"] }

# For smol
agnostic = { version = "0.8", features = ["smol"] }

Optional Features

# Enable networking
agnostic = { version = "0.8", features = ["tokio", "net"] }

# Enable DNS resolution
agnostic = { version = "0.8", features = ["tokio", "dns"] }

# Enable DNS over HTTPS with rustls
agnostic = { version = "0.8", features = ["tokio", "dns-over-https-rustls"] }

# Enable DNS over QUIC
agnostic = { version = "0.8", features = ["tokio", "dns-over-quic"] }

# Enable DNSSEC
agnostic = { version = "0.8", features = ["tokio", "dnssec-ring"] }

# Enable process management
agnostic = { version = "0.8", features = ["tokio", "process"] }

# Enable Quinn QUIC
agnostic = { version = "0.8", features = ["tokio", "quinn"] }

Feature Flags

Core Features

  • std (default): Standard library support
  • alloc: Allocation support

Runtime Features (choose one)

  • tokio: Tokio runtime support
  • smol: Smol runtime support

Component Features

  • net: Network abstractions (TCP, UDP)
  • dns: DNS resolution support
  • process: Process spawning and management
  • quinn: Quinn QUIC protocol support
  • tokio-io: Tokio I/O trait compatibility

DNS Transport Features

  • dns-over-quic: DNS over QUIC (RFC 9250)
  • dns-over-h3: DNS over HTTP/3
  • dns-over-https-rustls: DNS over HTTPS with rustls
  • dns-over-rustls: DNS over TLS with rustls
  • dns-over-openssl: DNS over TLS with OpenSSL
  • dns-over-native-tls: DNS over TLS with native-tls
  • dns-webpki-roots: Use webpki root certificates
  • dns-native-certs: Use OS native certificates

DNSSEC Features

  • dnssec: Basic DNSSEC support
  • dnssec-openssl: DNSSEC with OpenSSL
  • dnssec-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_std or 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.

Commit count: 173

cargo fmt