runestick 0.6.8

Runescript, a generic stack-based virtual machine for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! The `std::generator` module.

use crate::{ContextError, Generator, Module};

/// Construct the `std::generator` module.
pub fn module() -> Result<Module, ContextError> {
    let mut module = Module::new(&["std", "generator"]);
    module.ty(&["Generator"]).build::<Generator>()?;
    module.generator_state(&["GeneratorState"])?;

    module.inst_fn("next", Generator::next)?;
    module.inst_fn("resume", Generator::resume)?;
    Ok(module)
}