Hello!
I saw that rust HashMap can't be used in smart contracts as std in not allowed.
Is there an alternative?
I have a use case where for internal computation (not storage) I need to sum some values by keys and at the end retrieve all of the keys and their resulting sum.
Is there a way to do this without HashMap?
Hello, I had the same use case. There is no alternative to HashMap. You should rethink your algorithm to not require a hashmap. For me, I added a logic to send some values in ascending order only to the SC so then I could check when a value (key) changed and add them to a ManagedVec in a struct containing the key and value.
Hello, I had the same use case. There is no alternative to HashMap. You should rethink your algorithm to not require a hashmap. For me, I added a logic to send some values in ascending order only to the SC so then I could check when a value (key) changed and add them to a ManagedVec in a struct containing the key and value.