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
I'm trying to create a function that takes a ToDoc type (I made a trait that basically has the function (&self, &'a Allocator) -> Allocator::Doc) and returns a "document", without the caller having to care about allocators, however I'm constantly running into lifetime issues, and aside from going ham with mem::transmute, I'm not quite sure how to solve this. Currently, the only obstacle I have to being able to create a self-referential struct containing both the doc and the arena is the fact that all of the functions on the arena takes the arena by &'a Arena, instead of just &Arena, so I was wondering if there is a good reason for these two to be required to have the same lifetime?
The text was updated successfully, but these errors were encountered:
I guess RefDoc could take two lifetimes to separate the lifetime from the arena and the lifetime of the &str in Doc. That might fix the issues that you have.
I'm trying to create a function that takes a
ToDoc
type (I made a trait that basically has the function (&self, &'a Allocator) -> Allocator::Doc) and returns a "document", without the caller having to care about allocators, however I'm constantly running into lifetime issues, and aside from going ham withmem::transmute
, I'm not quite sure how to solve this. Currently, the only obstacle I have to being able to create a self-referential struct containing both the doc and the arena is the fact that all of the functions on the arena takes the arena by&'a Arena
, instead of just&Arena
, so I was wondering if there is a good reason for these two to be required to have the same lifetime?The text was updated successfully, but these errors were encountered: