generator

rust stackful generator library

Latest version: 0.8.8 registry icon
Maintenance score
81
Safety score
96
Popularity score
77
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.8.8 0 0 0 0 0
0.8.7 0 0 0 0 0
0.8.6 0 0 0 0 0
0.8.5 0 0 0 0 0
0.8.4 0 0 0 0 0
0.8.3 0 0 0 0 0
0.8.2 0 0 0 0 0
0.8.1 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.6 0 0 0 0 0
0.7.5 0 0 0 0 0
0.7.4 0 0 0 0 0
0.7.3 0 0 0 0 0
0.7.2 0 0 0 0 0
0.7.1 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.25 0 0 1 0 0
0.6.24 0 0 1 0 0
0.6.23 0 0 1 0 0
0.6.22 0 0 1 0 0
0.6.21 0 0 1 0 0
0.6.20 0 0 1 0 0
0.6.19 0 0 1 0 0
0.6.18 0 0 1 0 0
0.6.17 0 0 2 0 0
0.6.16 0 0 2 0 0
0.6.15 0 0 2 0 0
0.6.14 0 0 2 0 0
0.6.13 0 0 2 0 0
0.6.12 0 0 2 0 0
0.6.11 0 0 2 0 0
0.6.10 0 0 2 0 0
0.6.9 0 0 2 0 0
0.6.8 0 0 2 0 0
0.6.7 0 0 2 0 0
0.6.6 0 0 2 0 0
0.6.5 0 0 2 0 0
0.6.4 0 0 2 0 0
0.6.3 0 0 2 0 0
0.6.1 0 0 2 0 0
0.6.0 0 0 2 0 0
0.5.0 0 0 2 0 0
0.2.0 0 0 2 0 0
0.1.0 0 0 2 0 0

Stability
Latest release:

0.8.8 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Build Status Current Crates.io Version Document

Generator-rs

rust stackful generator library

[dependencies]
generator = "0.8"

Usage

use generator::{done, Gn};

fn main() {
    let g = Gn::new_scoped(|mut s| {
        let (mut a, mut b) = (0, 1);
        while b < 200 {
            std::mem::swap(&mut a, &mut b);
            b = a + b;
            s.yield_(b);
        }
        done!();
    });

    for i in g {
        println!("{}", i);
    }
}

Output

1
2
3
5
8
13
21
34
55
89
144
233

Goals

  • [x] basic send/yield with message support
  • [x] generator cancel support
  • [x] yield_from support
  • [x] panic inside generator support
  • [x] stack size tune support
  • [x] scoped static type support
  • [x] basic coroutine interface support
  • [x] stable rust support

based on this basic library

  • we can easily port python library based on generator into rust
  • coroutine framework running on multi thread

Notices

  • This crate supports below platforms, welcome to contribute with other arch and platforms

    • x86_64 Linux
    • x86_64 macOS
    • x86_64 Windows
    • x86_64 Fuchsia
    • x86_64 Android
    • aarch64 Linux
    • aarch64 macOS
    • aarch64 Fuchsia
    • aarch64 Android
    • loongarch64 Linux
    • armv7 Linux
    • riscv64 Linux
    • powerpc64le Linux

License

This project is licensed under either of the following, at your option: