You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use generator::*;fnmain(){letmut g:Generator<i32,f64> = Gn::new_opt(4096, || {let data = co_get_yield::<i32>();println!("yield: {:?}", data);co_yield_with(3.6);3.6f64});let ret = g.send(123);println!("resume: {:?}", ret);}// 输出:// yield: None// thread 'main' panicked at /home/skyfire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/generator-0.8.2/src/yield_.rs:127:32:// called `Option::unwrap()` on a `None` value// note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace//
The text was updated successfully, but these errors were encountered:
我需要在回调函数中yield,但是无法传递Scope对象到回调函数,会有生命周期的问题,只能通过自由函数 get_yield与yield_with获取和返回数据,如下代码可以正常运行:
但是get_yield与yield_with函数被标记为废弃,请问是否有替代函数?(co_get_yield和co_yield_with无法使用):
The text was updated successfully, but these errors were encountered: