Skip to content

Rust cheap coroutines with libc::*context

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

andreafioraldi/klo-routines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

klo-routines

Rust cheap coroutines with libc::*context

Example

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.

About

Rust cheap coroutines with libc::*context

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Languages