TokioLoop is an AsyncIO selector event loop implemented in Rust. The project provides two implementations:
- RLoop: mio-based implementation (single-threaded, functional)
- TokioLoop: tokio-based implementation (multi-threaded, in development)
Warning: TokioLoop is currently a work in progress and definitely not suited for production usage.
Note: TokioLoop is available on Unix systems only (Linux and macOS).
The current codebase for now have two event loops based on Rust:
- Architecture: Single-threaded event loop based on mio
- Future: Will be removed once TokioLoop achieves feature parity
- Status: In development
- Architecture: Multi-threaded event loop based on tokio
- Features: Basic infrastructure functional, TCP implementation in progress
- Future: Primary implementation once stable
git clone https://github.com/alanjds/tokioloop.git
cd tokioloop
maturin developimport asyncio
import rloop
asyncio.set_event_loop_policy(rloop.EventLoopPolicy())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)import asyncio
from rloop import TokioLoop
asyncio.set_event_loop_policy(rloop.TokioLoopPolicy())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)At current time, when compared with the stdlib's event loop, TokioLoop doesn't support the following features:
- Unix Domain Sockets
- SSL
- debugging
TokioLoop also doesn't implement the following methods:
loop.sendfileloop.connect_accepted_socketloop.sock_recvfromloop.sock_recvfrom_intoloop.sock_sendtoloop.sock_sendfile
While the stdlib's event loop will use the actual delay of callbacks when call_later is used with negative numbers, TokioLoop will treat those as call_soon, and thus the effective order will follow the invocation order, not the delay.
TokioLoop is released under the BSD License.
- Repository: https://github.com/alanjds/tokioloop
- Memory Bank:
memory-bank/directory for project context - Progress Report:
memory-bank/progress.mdfor implementation status