ironrdp-futures provides futures-rs runtime integration for IronRDP, implementing the framing traits from ironrdp-async using the futures crate’s async I/O traits.
Overview
This crate enables IronRDP to work with any executor compatible with thefutures crate by:
- Implementing
FramedReadandFramedWritefor futures I/O types - Providing stream wrappers for different
Sendscenarios - Offering runtime-agnostic async I/O
futures::io::AsyncRead and futures::io::AsyncWrite.
Quick Start
Stream Wrappers
The crate provides two stream wrapper types:FuturesStream (Send + Sync)
For streams that are bothSend and Sync:
S: Send + Sync + Unpin + AsyncRead/AsyncWrite
LocalFuturesStream (Local)
For local (non-Send) streams:
S: Unpin + AsyncRead/AsyncWrite (no Send requirement)
FramedRead Implementation
TheFuturesStream implements FramedRead using futures::io::AsyncReadExt:
Unlike Tokio’s implementation which uses
read_buf for zero-copy, the futures implementation reads into a fixed buffer and copies into BytesMut. This is slightly less efficient but compatible with the standard AsyncRead trait.FramedWrite Implementation
TheFuturesStream implements FramedWrite with automatic flushing:
Reading Frames
All theironrdp-async frame reading methods work seamlessly:
Writing Frames
Connection Example with async-std
Connection Example with smol
Performance Considerations
The futures implementation has slightly different performance characteristics than Tokio:- Buffer copying: Reads go through an intermediate buffer (1024 bytes) before copying to
BytesMut - Portability: Works with any
futures-compatible runtime - Simplicity: Standard trait implementation without runtime-specific optimizations
read_buf for zero-copy reads.
When to Use
Useironrdp-futures when:
- Working with async-std, smol, or other non-Tokio runtimes
- Need runtime-agnostic async code
- Want maximum portability across executors
- Building libraries that should work with any runtime
Compatible Runtimes
This crate works with any runtime that supportsfutures::io traits:
- async-std: Full-featured async runtime
- smol: Lightweight async executor
- futures::executor: Basic executor from futures crate
- custom executors: Any executor implementing futures traits
Dependencies
- ironrdp-async: Core async abstractions (re-exported)
- futures-util: futures I/O traits and utilities
- bytes: Efficient byte buffers
Re-exports
This crate re-exports all ofironrdp-async:
ironrdp_futures.
Related Crates
- ironrdp-async - Core async abstractions
- ironrdp-tokio - Tokio runtime integration
- ironrdp-blocking - Blocking I/O alternative
- ironrdp-tls - TLS upgrade helpers
- ironrdp-connector - Connection state machines

