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
In some views, the only way to discover the amount of items in them is to use for_each_key and count them. This pattern is common enough that it could be a method in the views themselves.
Proposal
Add a helper method to the views that store multiple items, and name it
len if the number of items is obtained O(1) (e.g. it is persisted in storage)
count if it needs to be calculated in O(n) (e.g., with the for_each_key described above)
The text was updated successfully, but these errors were encountered:
Motivation
In some views, the only way to discover the amount of items in them is to use
for_each_key
and count them. This pattern is common enough that it could be a method in the views themselves.Proposal
Add a helper method to the views that store multiple items, and name it
len
if the number of items is obtainedO(1)
(e.g. it is persisted in storage)count
if it needs to be calculated inO(n)
(e.g., with thefor_each_key
described above)The text was updated successfully, but these errors were encountered: