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
Whenever data is read via load or read, the data Ini instance is mutated in place, but a clone of the inner data is returned too. So I end up with two copies of the data.
Why return a clone of the data? HashMap's Clone implementation is recursive, so this ends up copying the entire structure. Am I missing something here?
Is it somehow possible to do something like Init::read, but only get one copy of the data in memory? I don't need two copies. I know that I can just drop the clone, but I don't see the point it copying data just to drop it.
The text was updated successfully, but these errors were encountered:
Whenever data is read via load or read, the data Ini instance is mutated in place, but a clone of the inner data is returned too. So I end up with two copies of the data.
Why return a clone of the data? HashMap's Clone implementation is recursive, so this ends up copying the entire structure. Am I missing something here?
Is it somehow possible to do something like Init::read, but only get one copy of the data in memory? I don't need two copies. I know that I can just drop the clone, but I don't see the point it copying data just to drop it.
This is intentional (to some extent), basically some implementations are intended to mutate in-place and others are meant to return, so it provides the best of both worlds at the cost of using more memory. If you wanted, you could simply not assign it and the compiler would know to discard the return value. In all cases, the internal impl will need to store a hashmap. In the future however, it might be beneficial to do load_inplace() / read_inplace()-esque functions.
Whenever data is read via
load
orread
, the dataIni
instance is mutated in place, but a clone of the inner data is returned too. So I end up with two copies of the data.Why return a clone of the data?
HashMap
'sClone
implementation is recursive, so this ends up copying the entire structure. Am I missing something here?Is it somehow possible to do something like
Init::read
, but only get one copy of the data in memory? I don't need two copies. I know that I can just drop the clone, but I don't see the point it copying data just to drop it.The text was updated successfully, but these errors were encountered: