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
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Currently storage items have put and get. This can be fairly cumbersome when all you want to do is a minor mutation like push an item to the end of a Vec or increment by 1.
We should introduce the mutate API which basically works as:
structX{
fn get() -> Option<Value> { ... }fnput(v:Value){ ...}fnkill(){ ...}fnmutate<F:FnOnce(mutv:Option<Value>)>(key:Key,f:F){letmut a = Self::get();f(a);match a {None => Self::kill(),Some(v) => Self::put(v),}}}
It should work correctly with maps (an extra key parameter and s/put,kill/insert,remove/) and with default/required variations (s/Option/Value/).