m4b / goblin

An impish, cross-platform binary parsing crate, written in Rust
MIT License
1.17k stars 156 forks source link

Alternative owned data version? #375

Open mlgiraud opened 11 months ago

mlgiraud commented 11 months ago

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?