Rust: Provide a trait method to (optionally) control resource allocation#1625
Rust: Provide a trait method to (optionally) control resource allocation#1625cpetig wants to merge 6 commits into
Conversation
alexcrichton
left a comment
There was a problem hiding this comment.
I like the idea, thanks! I've got some comments below, but let me know if you'd prefer to not handle anything in particular.
|
@cpetig ok I tried my hand a this a bit and resulted in the last commit here. Everything looks good to me now but I'd want to run that by you to confirm. I realized that ideally what I want is: trait GuestThing {
type Rep: ResourceRep = Box<Option<T>>;
// ...
}however defaults for associated bounds aren't stable in Rust. In lieu of that I did a, now unrelated, refactoring to the I also realized that the One possible future option is to basically require all Rust exported resources to manually say |
This enables resource allocation from a user provided arena instead of the heap.
Arena implementation in test case generated by genAI.