An open API service indexing awesome lists of open source software.

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

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.