-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to resize StackFutures #6
Comments
@eholk Hello, after digging into the code. I found that the main challenge to implementing |
Oh, that's a good point. I thought we'd have enough type information still to do it, but we need to save some more. I think the best way to do this then would be to add another function to |
I don't quite get what the function alongside |
Yeah, I think you'd need a |
Thanks a lot! I know how to do this. |
It'd be helpful to have a way to shrink (or less commonly, grow) a
StackFuture
. For example, sometimes you have an object that implements a trait and needs to forward calls to another object that implements the same trait. Right now that's impossible withStackFuture
without boxing the child future because otherwise you'd have to have a future contain a future that's the same size as itself. That said, there will usually be some extra space so we might be able to dynamically shrink aStackFuture
.The signature would probably be something like:
Then using this would look something like:
The idea here is we'd try to fit the future into a smaller container, but if it doesn't fit then the
resize
returns the original future and we can either decide to pay the allocation cost (as we did in this example) or give up.The text was updated successfully, but these errors were encountered: