ironrdp-tokio provides Tokio runtime integration for IronRDP, implementing the framing traits from ironrdp-async using Tokio’s async I/O primitives.
Overview
This crate bridges IronRDP’s async abstractions with the Tokio runtime by:- Implementing
FramedReadandFramedWritefor Tokio streams - Providing specialized stream wrappers with different
Sendsemantics - Offering optional HTTP client integration via reqwest
Quick Start
Stream Wrappers
The crate provides three stream wrapper types with different trait bounds:TokioStream (Send + Sync)
For streams that are bothSend and Sync, enabling use across threads:
S: Send + Sync + Unpin + AsyncRead/AsyncWrite
LocalTokioStream (Local)
For local (non-Send) streams like LocalSet tasks:
S: Unpin + AsyncRead/AsyncWrite (no Send requirement)
MovableTokioStream (Send)
For streams that areSend but not Sync:
S: Send + Unpin + AsyncRead/AsyncWrite
Splitting Streams
Split a framed stream into separate read and write halves:- Concurrent reading and writing
- Separate read/write task responsibilities
- Pipeline architectures
FramedRead Implementation
TheTokioStream implements FramedRead using Tokio’s AsyncReadExt::read_buf:
read_buf for zero-copy reading into BytesMut buffers.
FramedWrite Implementation
TheTokioStream implements FramedWrite with automatic flushing:
HTTP Client Integration
With thereqwest feature, get an HTTP client for network authentication:
Features
reqwest: Enables reqwest-based HTTP client (base feature)reqwest-rustls-ring: Use rustls with ring crypto for TLSreqwest-native-tls: Use native platform TLS
Complete Connection Example
Performance Considerations
Tokio integration provides excellent performance:- Zero-copy reads:
read_bufwrites directly intoBytesMut - Efficient buffering: Minimal allocations via
bytescrate - Optimal scheduling: Tokio’s work-stealing scheduler handles multiple connections efficiently
When to Use
Useironrdp-tokio when:
- Building with the Tokio ecosystem
- Need high-performance async I/O
- Want integration with Tokio libraries (hyper, tonic, etc.)
- Require concurrent connection handling
Dependencies
- ironrdp-async: Core async abstractions (re-exported)
- tokio: Async runtime (with
io-utilfeatures) - bytes: Efficient byte buffers
- reqwest (optional): HTTP client for network auth
- sspi (optional): Windows authentication
- url (optional): URL parsing
Re-exports
This crate re-exports all ofironrdp-async:
ironrdp_tokio.
Related Crates
- ironrdp-async - Core async abstractions
- ironrdp-futures - futures runtime integration
- ironrdp-blocking - Blocking I/O alternative
- ironrdp-tls - TLS upgrade helpers
- ironrdp-connector - Connection state machines

