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
This throws a compiler error saying that the lifetime of helper may outlive the future because of the pinned box. I typed this in GitHub's text editor so apologies if there's bugs in the above code (tried to distill down my actual code).
Is this a scenario that ouroboros doesn't handle well yet? I'm a little surprised the borrow lifetime is thought to extend past the await of the build.
The text was updated successfully, but these errors were encountered:
vlovich
changed the title
Struggling to make lifetimes happy for async
Struggling to make lifetimes happy for async with temporary borrow
May 1, 2024
vlovich
changed the title
Struggling to make lifetimes happy for async with temporary borrow
Struggling to make lifetimes happy for async with temporary borrow of other data during build
May 1, 2024
Unfortunately ouroboros internally requires that the future returned by the builder lives for at least the 'this lifetime. I went in and tried playing around with it to get it to accept any other lifetime bound, but it would always throw borrow check errors on simple test cases. If you would like to try looking for a possible solution yourself, the code ouroboros generates for constructing asynchronously looks like this:
I'm trying to do something that looks something like this:
This throws a compiler error saying that the lifetime of
helper
may outlive the future because of the pinned box. I typed this in GitHub's text editor so apologies if there's bugs in the above code (tried to distill down my actual code).Is this a scenario that ouroboros doesn't handle well yet? I'm a little surprised the borrow lifetime is thought to extend past the await of the build.
The text was updated successfully, but these errors were encountered: