Is there something equivalent to python generator.send?

Rust has generators feature, but whether there is some equivalence to Python generator.send? Is there some workaround to achieve it?

(It's hard to search it, because send in rust has special meaning)

This question is probably a better fit for URLO (the user-facing forum), but looking at the docs, the resume function takes an arbitrary argument, which appears to be what you're looking for.

fn resume(
    self: Pin<&mut Self>, 
    arg: R
) -> GeneratorState<Self::Yield, Self::Return>;
1 Like

Thanks! I’ve found it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.