Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zonyitoo/context-rs
Context utilities in Rust
https://github.com/zonyitoo/context-rs
Last synced: about 5 hours ago
JSON representation
Context utilities in Rust
- Host: GitHub
- URL: https://github.com/zonyitoo/context-rs
- Owner: zonyitoo
- License: apache-2.0
- Created: 2015-08-09T14:19:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-05T03:27:22.000Z (over 1 year ago)
- Last Synced: 2025-01-04T03:07:29.577Z (7 days ago)
- Language: Assembly
- Size: 234 KB
- Stars: 86
- Watchers: 3
- Forks: 22
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# context-rs
[![Build & Test](https://github.com/zonyitoo/context-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/zonyitoo/context-rs/actions/workflows/ci.yml)
[![License](https://img.shields.io/crates/l/context.svg)](https://github.com/zonyitoo/context-rs)This project offers an easy interface to the famous
[Boost.Context](http://www.boost.org/doc/libs/1_60_0/libs/context/doc/html/context/overview.html)
library and thus provides _the building blocks for higher-level abstractions,
like coroutines, cooperative threads (userland threads) or
an equivalent to C# keyword yield in C++._[**API documentation**](https://docs.rs/context)
## Usage
To use `context`, first add this to your `Cargo.toml`:
```toml
[dependencies]
context = "3.0"
```And then add this to your source files:
```rust
extern crate context;
```## Performance
The performance heavily depends on the architecture and even on the operating
system. A context switch itself is usually as fast as a regular function call
though and can thus be viewed as one.To see this for yourself run `cargo bench resume`. You can then compare the
results of the `resume` benchmarks (which uses `Context::resume()`) to the
results of `resume_reference_perf` (which uses regular function calls).## Platforms
Architecture | Linux (UNIX) | Windows | MacOS X | iOS
--------------|-------------------|------------|---------------|---------------
i386 | SYSV (ELF) | MS (PE) | SYSV (MACH-O) | -
x86_64 | SYSV, X32 (ELF) | MS (PE) | SYSV (MACH-O) | -
arm (aarch32) | AAPCS (ELF) | AAPCS (PE) | - | AAPCS (MACH-O)
arm (aarch64) | AAPCS (ELF) | AAPCS (PE) | - | AAPCS (MACH-O)
mips1 | O32 (ELF) | - | - | -
mips64 | N64 (ELF) | - | - | -
ppc32 | SYSV (ELF), XCOFF | - | SYSV (MACH-O) | -
ppc64 | SYSV (ELF), XCOFF | - | SYSV (MACH-O) | -
loongarch64 | SYSV (ELF) | - | - | -
riscv64 | SYSV (ELF) | - | - | -
s390x | SYSV (ELF) | - | - | -Format: `ABI (binary format)`.
Source: [Boost.Context](http://www.boost.org/doc/libs/1_60_0/libs/context/doc/html/context/architectures.html)