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
We can save space if we remove identifiers from storage values. For example, Storage<AccountId, Account> is really Storage<AccountId, (AccountId, Metadata)>. It also prevents accidentally leaving the world in an inconsistent state by mutating the identifier in the value separately from the key.
This could look like the following:
structAssetId(...);enumAssetValue{ ... };structAsset{id:AssetId,value:AssetValue,}// could be a generic struct representing an `mv` entrystructAssetEntry<'world>{id:&'world AssetId,value:&'world AssetValue,}structAssetEntryMut<'world>{id:&'world AssetId,value:&'world mutAssetValue,}structWorld{assets:Storage<AssetId,AssetValue>,
...
}implWorld{fniter_assets(&self) -> implIterator<Item = AssetEntry>{self.assets().iter().map(|(id, value)| AssetEntry{ id, value })}fnasset_mut(&mutself,id:&AssetId) -> Result<&mutAssetValue,FindError>{
...}}
I encountered a problem with queries while trying this: predicates don't seem to support inputs with lifetimes.
Would this be worth pursuing?
The text was updated successfully, but these errors were encountered:
We can save space if we remove identifiers from storage values. For example,
Storage<AccountId, Account>
is reallyStorage<AccountId, (AccountId, Metadata)>
. It also prevents accidentally leaving the world in an inconsistent state by mutating the identifier in the value separately from the key.This could look like the following:
I encountered a problem with queries while trying this: predicates don't seem to support inputs with lifetimes.
Would this be worth pursuing?
The text was updated successfully, but these errors were encountered: