Crate easyfibers [−] [src]
easyfibers is a closure-less couroutine library for executing asynchronous tasks as painlessly as possible.
The goal is to enable writing network protocols seamlessly and efficiently.
easyfibers is organized into three levels:
- Poller that polls on sockets (mio), dns lookups and timers. Also holds unused execution stacks (context-rs).
- Runners that get events from poller and runs fibers.
- Fibers that are executed by runners. Each fiber runs in its own stack and gets automatically scheduled out on blocking operations like write/read.
Code example at: https://github.com/SergejJurecko/easyfibers
Structs
Fiber |
Available within the fiber execute function to configure fiber or create child fibers. Child fibers return results to parent fibers instead of poller on main stack. |
FiberRef |
Reference to fiber on main stack. |
Poller |
Used to poll on sockets and timers. There can only be 1 poller per thread. |
Runner |
Runner executes fibers on main stack. There can be multiple pollers each with its own fibers of a particular type. |
Enums
SocketType |
Socket type to connect to using new_resolve_connect function. For SSL/TLS use tcp first, then call tcp_tls_connect inside fiber. |
Type Definitions
FiberFn |
Fiber execute function. It receives current fiber, parameter that was used to start the fiber and returns result that will be result of fiber. |