Closed wiiznokes closed 1 month ago
It's better not to allocate the data. Keep the original buffer and you won't need to clone the data.
I'm not sure to understand, are you suggesting to store the buffer outside of this crate ? This will be impossible because of self reference.
The current api does not own the source data. This cause problem to cache the entries in the app state. You basically need to clone all the field you're interested in. Currently, libcosmic does it https://github.com/pop-os/libcosmic/blob/master/src/desktop.rs and this plugin https://github.com/pop-os/launcher/blob/master/plugins/src/desktop_entries/mod.rs. But by doing this, you loose the posibility to do a search using this crate.
I propose to change the API, to remove the lifetime on DesktopEntry. This way, we could cache all entries in the app state. This will also help memory consumption i believe, because we could filter the locales we're not uninterested in.
I would be happy to work on this if this is wanted :) @mmstick ?