Skip to content
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

Alternative owned data version? #375

Closed
mlgiraud opened this issue Aug 11, 2023 · 1 comment
Closed

Alternative owned data version? #375

mlgiraud opened this issue Aug 11, 2023 · 1 comment

Comments

@mlgiraud
Copy link

Hi, are there any plans on providing an alternative API where the data is not Borrowed by the goblin objects? The current api is problematic, when i want to for example save an Elf object that was parsed from some data in a struct. This then requires the custom struct to pass through the lifetime annotation, and also the data from which the elf object was parsed needs to be immutably borrowed for as long as this overarching struct lives. I would find it very useful to have an API where there is no lifetime annotation and instead the goblin objects simply take ownership of the data buffer.
Any thoughts on this? Or am i overlooking some easy solution to this problem?

@m4b
Copy link
Owner

m4b commented Jul 28, 2024

sorry for the delay; there are no plans at the moment for adding an owned version; the main issue is that the string table is zero-copy and returns out references to the underlying data that backs it; there might be some mechanism where we can provide ownership with the same structs, but in general this is hard in rust imho. if you end up doing something interesting, feel free to post your solution here.

closing this for now as there is no plans on adding an owned version

@m4b m4b closed this as completed Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants