#runtime-agnostic #async #sansio

no-std agnostic-io

agnostic-io defines I/O traits in agnostic style for any async runtime

4 releases

Uses new Rust 2024

0.2.0 Nov 4, 2025
0.1.2 Feb 24, 2025
0.1.1 Jan 30, 2025
0.1.0 Jan 27, 2025

#2285 in Asynchronous

Download history 144/week @ 2025-11-15 101/week @ 2025-11-22 168/week @ 2025-11-29 176/week @ 2025-12-06 303/week @ 2025-12-13 108/week @ 2025-12-20 78/week @ 2025-12-27 73/week @ 2026-01-03 55/week @ 2026-01-10 169/week @ 2026-01-17 290/week @ 2026-01-24 261/week @ 2026-01-31 171/week @ 2026-02-07 46/week @ 2026-02-14 86/week @ 2026-02-21 60/week @ 2026-02-28

427 downloads per month
Used in 18 crates (6 directly)

MIT/Apache

17KB
54 lines

Agnostic I/O

agnostic-io defines I/O traits in Sans-I/O style for any async runtime.

github LoC Build codecov

docs.rs crates.io crates.io license

Introduction

agnostic-io provides runtime-agnostic I/O traits following the Sans-I/O design philosophy. It defines standardized async I/O interfaces that work across tokio, smol, and other runtimes without coupling your protocol implementations to specific I/O primitives.

What is Sans-I/O?

Sans-I/O (French for "without I/O") is a design pattern that separates protocol logic from I/O implementation. Instead of tightly coupling your code to specific I/O libraries, you:

  1. Define abstract I/O traits (what agnostic-io provides)
  2. Implement your protocol logic against these traits
  3. Let runtime-specific implementations handle the actual I/O

This approach makes your code:

  • Testable: Mock I/O without real sockets
  • Portable: Works with any async runtime
  • Reusable: Protocol implementations work everywhere
  • Maintainable: Changes to I/O layer don't affect protocol logic

Key Features

  • Runtime Agnostic: Works with tokio, smol, and more
  • no_std Compatible: Can be used in embedded environments
  • Zero-Cost: Trait-based design compiles away
  • Comprehensive: AsyncRead, AsyncWrite, AsyncSeek, and more
  • Tokio Compatible: Optional compatibility layer for tokio traits

Installation

[dependencies]
agnostic-io = "0.2"

Feature Flags

# Standard library support (default)
agnostic-io = { version = "0.1", features = ["std"] }

# Allocation support without std
agnostic-io = { version = "0.1", default-features = false, features = ["alloc"] }

# Tokio I/O trait compatibility
agnostic-io = { version = "0.1", features = ["tokio"] }

# no_std without allocations
agnostic-io = { version = "0.1", default-features = false }

Tokio Compatibility

When using the tokio feature, agnostic-io provides compatibility with tokio::io traits:

[dependencies]
agnostic-io = { version = "0.1", features = ["tokio"] }

Feature Flags

  • std (default): Standard library support
  • alloc: Allocation support without std
  • tokio: Compatibility with tokio::io traits

License

agnostic-io 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.

Dependencies

~0–1MB
~14K SLoC