https://github.com/andreafioraldi/klo-routines
Rust cheap coroutines with libc::*context
https://github.com/andreafioraldi/klo-routines
Last synced: about 1 year ago
JSON representation
Rust cheap coroutines with libc::*context
- Host: GitHub
- URL: https://github.com/andreafioraldi/klo-routines
- Owner: andreafioraldi
- License: apache-2.0
- Created: 2021-07-15T15:13:47.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-16T07:27:29.000Z (almost 5 years ago)
- Last Synced: 2025-03-27T13:51:12.607Z (about 1 year ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# klo-routines
Rust cheap coroutines with libc::*context
## Example
```rust
use klo_routines::{flush, KloRoutine};
fn main() {
let mut cnt = 0;
let mut func = || {
for _ in 0..16 {
flush(cnt);
cnt += 1;
}
};
let mut klo = KloRoutine::new(&mut func);
while let Some(n) = klo.resume() {
println!("{}", n);
}
// or you can use it as iterator
// for n in &mut klo {
// println!("{}", n);
// }
}
```
#### License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.