Skip to content

Don't borrow allocator for 'a lifetime #58

@Alxandr

Description

@Alxandr

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions