Skip to content
Discussion options

You must be logged in to vote

It doesn't solve the original question (how to provide a Python iterator of rows), but what I've done in a similar situation was to switch to internal iteration. Meaning, the Rust code that iterates over the rows gets a Python function that it executes for each row (or bunch of rows, or ...) and which can, if needed, indicate in its return value whether to break iteration.

Regarding the original problem you could, maybe, move the Connection into a Python object - this guarantees a stable address - and then move the RowIter into another Python object that holds onto a reference to the Connection (this guarantees its being kept alive as long as needed), and the Rust lifetime erased/transmut…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@StuartHadfield
Comment options

@davidhewitt
Comment options

@StuartHadfield
Comment options

Answer selected by StuartHadfield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants